Skip to content

Is it possible to run 2 applications at the same time in the same main file? #4796

Answered by micalevisk
scriptyyy13 asked this question in Q&A
Discussion options

You must be logged in to vote

You can just call express twice

const express = require('express')

const app1 = express()
app1.get('/', function (req, res) {
  res.send('foo')
})
app1.listen(3000)

const app2 = express()
app2.get('/', function (req, res) {
  res.send('bar')
})
app2.listen(3001)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@scriptyyy13
Comment options

Answer selected by scriptyyy13
Comment options

You must be logged in to vote
1 reply
@scriptyyy13
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants