Created
March 11, 2015 10:56
-
-
Save moomoo-ya/77fab8fdc868fdb36378 to your computer and use it in GitHub Desktop.
Express.js Sample by TypeScript
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
import express = require('express'); | |
import http = require('http'); | |
var app = express(); | |
app.set('port', process.env.PORT || 3000); | |
app.get('/', function(req: express.Request, res: express.Response) { | |
res.send('Hello, world!'); | |
}); | |
http.createServer(app).listen(app.get('port'), function() { | |
console.log('Express server listening on port ' + app.get('port')); | |
}); |
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
13c13 | |
< /// <reference path="./node.d.ts" /> | |
--- | |
> /// <reference path="../node/node.d.ts" /> |
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
{ | |
"name": "express-sample2", | |
"version": "1.0.0", | |
"description": "Practice for Express.js.", | |
"main": "app.js", | |
"dependencies": { | |
"express": "^4.12.2", | |
"jade": "^1.9.2" | |
}, | |
"devDependencies": { | |
"stylus": "^0.50.0", | |
"typescript": "^1.4.1" | |
}, | |
"scripts": { | |
"start": "node app.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment