Skip to content

Commit

Permalink
Avoid port conflict between server port and playground port
Browse files Browse the repository at this point in the history
  • Loading branch information
bidoubiwa committed Jul 3, 2023
1 parent d0dc502 commit ddb3082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: scrapix:latest
restart: always
ports:
- 3000:3000
- 8080:8080
environment:
- REDIS_URL=redis://redis:6379

Expand All @@ -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
- 6379:6379
8 changes: 4 additions & 4 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,16 +16,16 @@ 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, () =>
console.log(`Example app listening on port ${port}!`)
)
}

__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')
Expand Down

0 comments on commit ddb3082

Please sign in to comment.