[Node.js]24. Level 5: Express, Express routes

Create an express route that responds to GET requests at the URL /tweets that responds with the filetweets.html located in the same directory as app.js

Make sure you create the app and listen on port 8080

var express = require('express');
var app = express.createServer(); app.get('/tweets', function(request, response){
response.sendfile(__dirname + "/tweets.html");
}); app.listen(8080);
上一篇:埃氏筛法求素数&构造素数表求素数


下一篇:shell相关命令