Last active
August 29, 2015 14:08
-
-
Save cheng470/cbbc636c64ed74232ba6 to your computer and use it in GitHub Desktop.
express 框架的 hello world 例子
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
app.get('/hello.txt', function (req, res) { | |
res.send('Hello World'); | |
}); | |
var server = app.listen(3000); | |
// 浏览器访问 http://127.0.0.1:3000/hello.txt | |
// 响应报文 | |
/* | |
HTTP/1.1 200 OK | |
X-Powered-By: Express | |
Content-Type: text/html; charset=utf-8 | |
Content-Length: 11 | |
ETag: W/"b-4a17b156" | |
Date: Fri, 07 Nov 2014 14:11:43 GMT | |
Connection: keep-alive | |
Hello World | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment