2013년 12월 21일 토요일
2013년 12월 5일 목요일
Express.js sample
var express = require('express'), http = require('http');
var app = express();
app.all("*", function(request, response, next) {
response.writeHead(200, {
"Content-Type" : "text/plain"
});
next();
});
app.get("/", function(request, response) {
response.end("Welcome to the homepage!");
});
app.get("/about", function(request, response) {
response.end("Welcome to the about page!");
});
app.get("/hi/:user", function(req, res) {
res.end("Hi, " + req.params.user + ".");
});
app.get("*", function(request, response) {
response.end("404!");
});
http.createServer(app).listen(1337);
console.log('Server running at http://127.0.0.1:1337/');
var app = express();
app.all("*", function(request, response, next) {
response.writeHead(200, {
"Content-Type" : "text/plain"
});
next();
});
app.get("/", function(request, response) {
response.end("Welcome to the homepage!");
});
app.get("/about", function(request, response) {
response.end("Welcome to the about page!");
});
app.get("/hi/:user", function(req, res) {
res.end("Hi, " + req.params.user + ".");
});
app.get("*", function(request, response) {
response.end("404!");
});
http.createServer(app).listen(1337);
console.log('Server running at http://127.0.0.1:1337/');
피드 구독하기:
글
(
Atom
)