Running multiple Node (Express) apps on same port

前端 未结 3 445
情话喂你
情话喂你 2020-11-29 16:27

I have multiple Node applications (build on Express framework).

Now I have placed them like this -

  • /var/www/app1
  • /var/www/a
3条回答
  •  旧时难觅i
    2020-11-29 17:10

    You can use app.use():

    app
      .use('/app1', require('./app1/index').app)
      .use('/app2', require('./app2/index').app)
      .listen(8080);
    

提交回复
热议问题