简体   繁体   中英

how to deploy nodejs rest api with express framework on production server windows

I have created a node.js rest api created using express framework for routing. I have used tutorial

Now I want to deploy that rest api on actual production server. How to achieve that thing.

I have gone through below links.

Deploy node js application with express framework on production mode --- Only for linux. I need for windows.

Deploying NodeJs Express Rest API to Windows 10 IoT -- a little bit similar problem but no solution

https://stackoverflow.com/a/38652869/2810015 -- this said to run npm start on production server after copying all of the files on server. But this is not working fine either.

Any help will be highly useful.

You use pm2?

Usually I use it to start the application. It works for both windows and linux. He leaves the service initated, and in case something happens that knocks the service up again.

You install it on the server, and instead of using it

node server.js

You use the command below

pm2 server.js start

Link: http://pm2.keymetrics.io/docs/advanced/pm2-module-system/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM