Server.js/*The following code will be explained in detail below.*/varExpress = require (' Express ');//used to introduce express modulesvarApp = Express ();//Express Instance ObjectApp.set (' Port ', Process.env.PORT | | 3000);varFavicon = require (' Serve-favicon '));//Server.jsvarTOUSD = require ('./routes/tousd.js '));//App.use (TOUSD.AAA);//Console.log (TOUSD.AAA ())//Console.log (TOUSD.BBB ())App.use (TOUSD.BBB);//set Port toApp.get ('/',function(req, res) {//set the route of the home page with '/' representationRes.send (' Ritsu Yan6668978989474561212565645 ')})//The middleware attached to/user/:id, any request to/user/:id will execute itApp.use ('/user/:id ',function(req, res, next) {Console.log (' Request Type: ', Req.method); Next ();}); App.get ('/about ',function(req, res) {//set the route of the About page with '/about ' representationRes.send (' The node course ')}) App.use (function(req, res, next) {//set 404 PageRes.status (404); Res.send (' 404-not Found ')}) App.listen (App.get (' Port '),function() {//Listening Port If a user enters a page to send a request we output the following statementConsole.log (' Express started on Port 3000 ')})
Portal: http://www.runoob.com/nodejs/nodejs-express-framework.html
"Front node. JS Framework" node. JS Framework Express