Before using node's expree to build the server, today to try to use Forever-service to build.
First download node's service:
Global Installation--"
NPM Install-g Forever (if an error appears to see if the permissions are not the problem sudo gives permission)
NPM Install-g Forever-service Ibid.
[sudo] npm install Forever-monitor
Directly on JS can be used forever start app.js
App.js is you use node
Stop: Forever Stop App.js
Paste my app.js content for your reference:
var http=require (' http ');
var express=require (' Express ');
var app=express ();
App.use ("/", function (req,res) {
var Path=req.path;
if (Path.indexof (".") = = =-1) {
Here is the file that says no suffix is entered on the index page. The specific people to write according to their own circumstances.
Path = "/index.html";
}
Res.sendfile (__dirname+ Path)
})
Http.createserver (APP). Listen (' 8000 ', function () {
Console.log (' OK ')
})
Using node to build a server