Created
September 6, 2013 15:06
-
-
Save kuronekomichael/6465127 to your computer and use it in GitHub Desktop.
expressで静的なJSONを返すだけのサーバを極力小さいコードで書いた感じ $ npm init
$ npm install express --save-dev
$ npm start
This file contains 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'), | |
port = 48172, | |
ret = { name:'hello', value:'world' }; | |
express().get('/', function(req, res) { | |
res.contentType('application/json').send(JSON.stringify(ret)); | |
}).listen(port, function() { | |
console.log("express server on localhost:%d", this.address().port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment