From ddb308227cf08e1db5bc6a4c7fef83d90bad4c21 Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Mon, 3 Jul 2023 14:08:15 +0200 Subject: [PATCH] Avoid port conflict between server port and playground port --- docker-compose.dev.yml | 6 +++--- src/server.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 00e6f64..51f0aad 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -6,7 +6,7 @@ services: image: scrapix:latest restart: always ports: - - 3000:3000 + - 8080:8080 environment: - REDIS_URL=redis://redis:6379 @@ -19,9 +19,9 @@ services: - MEILI_NO_ANALYTICS=true - MEILI_MASTER_KEY=masterKey - MEILI_ENV=development - + redis: image: redis:latest restart: always ports: - - 6379:6379 \ No newline at end of file + - 6379:6379 diff --git a/src/server.ts b/src/server.ts index 688c46c..3d0a95d 100644 --- a/src/server.ts +++ b/src/server.ts @@ -6,7 +6,7 @@ import TaskQueue from './taskQueue.js' import { Sender } from './sender.js' import Crawler from './crawler.js' -const port = process.env.PORT || 3000 +const port = process.env.PORT || 8080 class Server { taskQueue: TaskQueue @@ -16,8 +16,8 @@ class Server { this.taskQueue = new TaskQueue() this.app = express() this.app.use(express.json()) - this.app.post('/crawl', this.__crawl.bind(this)) - this.app.post('/crawl/async', this.__crawl.bind(this)) + this.app.post('/crawl', this.__asyncCrawl.bind(this)) + this.app.post('/crawl/async', this.__asyncCrawl.bind(this)) this.app.post('/crawl/sync', this.__syncCrawl.bind(this)) this.app.listen(port, () => @@ -25,7 +25,7 @@ class Server { ) } - __crawl(req: express.Request, res: express.Response) { + __asyncCrawl(req: express.Request, res: express.Response) { this.taskQueue.add(req.body) console.log('Crawling started') res.send('Crawling started')