Skip to content

Instantly share code, notes, and snippets.

@moomoo-ya
Created March 11, 2015 10:56
Show Gist options
  • Save moomoo-ya/77fab8fdc868fdb36378 to your computer and use it in GitHub Desktop.
Save moomoo-ya/77fab8fdc868fdb36378 to your computer and use it in GitHub Desktop.
Express.js Sample by TypeScript
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'));
});
13c13
< /// <reference path="./node.d.ts" />
---
> /// <reference path="../node/node.d.ts" />
{
"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