mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
27 lines
665 B
TypeScript
27 lines
665 B
TypeScript
/// <reference path="./node.d.ts" />
|
|
|
|
/**
|
|
* See the node.js TypeScript definition needed for this
|
|
* example here: https://github.com/borisyankov/DefinitelyTyped
|
|
*/
|
|
|
|
import * as Http from "http";
|
|
|
|
class MyServer {
|
|
private header:Object = {'Content-Type': 'text/plain'};
|
|
|
|
constructor() {
|
|
var server:Http.Server = Http.createServer(this.onRequest);
|
|
server.listen(3000, () => {
|
|
console.log("Server started on port 3000");
|
|
});
|
|
}
|
|
|
|
private onRequest(request:Http.ServerRequest, response:Http.ServerResponse):void {
|
|
response.writeHead(200, this.header);
|
|
response.end("Hello TypeScript & node.js");
|
|
}
|
|
}
|
|
|
|
var myServer = new MyServer();
|