conscious-sapphire
conscious-sapphire2y ago

Problem using express

I have POST Request /api/web-crawler for webCrawler method, but when I try to call the api, I get the error Error: socket hang up
import express, {Request, Response} from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import {crawlerRoute} from "./src/routes/crawlerRoute";

const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cors());

app.use('/api', crawlerRoute);

export default app;
import express, {Request, Response} from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import {crawlerRoute} from "./src/routes/crawlerRoute";

const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cors());

app.use('/api', crawlerRoute);

export default app;
No description
3 Replies
conscious-sapphire
conscious-sapphireOP2y ago
No description
conscious-sapphire
conscious-sapphireOP2y ago
Do I have to run a web server on the Apify platform?(https://docs.apify.com/academy/running-a-web-server#building-the-actor)
Running a web server on the Apify platform | Academy | Apify Docume...
A web server running in an actor can act as a communication channel with the outside world. Learn how to easily set one up with Node.js.
Oleg V.
Oleg V.2y ago
Yes, correct. You can use article above (https://docs.apify.com/academy/running-a-web-server#building-the-actor) for the inspiration. It should work. Good luck)

Did you find this page helpful?