[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);

 

posted @ 2014-07-31 15:30  Zhentiw  阅读(128)  评论(0编辑  收藏  举报