简体   繁体   中英

How does Express work?

I am learning MEAN stack and learnt how it starts like,

var http = require('http'),
    express = require('exress'),
    app = express();
app.listen(8080);

and I type node example.js on terminal then I can check it on the Web browser. If I stop process on terminal(in my case, it is ctrl + C), it does not show up on the Web browser. So I wonder if I use MEAN stack cloud server(like aws or digitalocean), should I have to keep terminal which connects cloud server on all the time, so that users can connect my website 24/7 via typing domain? Thanks!

You should run node app process in the background , you run command line as below:

$nohup node simple-server.js > output.log &

Or you can use forever: http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/

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