Skip to content

Instantly share code, notes, and snippets.

@prettymuchbryce
Last active April 29, 2021 14:50

Revisions

  1. prettymuchbryce revised this gist May 8, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.ts
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,10 @@
    /// <reference path="./.node-definitions/node.d.ts" />

    /**
    * See the node.js TypeScript definition needed for this
    * example here: https://github.com/borisyankov/DefinitelyTyped
    */

    import Http = module('http');

    class MyServer {
  2. prettymuchbryce revised this gist May 8, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.ts
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    import Http = module('http');

    class MyServer {
    header:Object = {'Content-Type': 'text/plain'};
    private header:Object = {'Content-Type': 'text/plain'};

    constructor() {
    var server:Http.Server = Http.createServer(this.onRequest);
  3. prettymuchbryce revised this gist May 8, 2013. 1 changed file with 6 additions and 13 deletions.
    19 changes: 6 additions & 13 deletions gistfile1.ts
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,18 @@
    /// <reference path="./.node-definitions/node.d.ts" />

    /**
    * See the node.js TypeScript definition needed for this
    * example here: https://github.com/borisyankov/DefinitelyTyped
    */

    import Http = module('http');
    import Net = module('net');

    class MyServer {

    private header : Object = {'Content-Type': 'text/plain'};
    header:Object = {'Content-Type': 'text/plain'};

    constructor() {
    var server : Http.Server = Http.createServer(this.onRequest);
    var server:Http.Server = Http.createServer(this.onRequest);
    server.listen(3000);
    console.log("Server starting..");
    }

    private onRequest(request,response) {
    response.writeHead(200,this.header);
    response.end("hello TypeScript & node.js");
    private onRequest(request:Http.ServerRequest, response:Http.ServerResponse):void {
    response.writeHead(200, this.header);
    response.end("Hello TypeScript & node.js");
    }
    }

  4. prettymuchbryce revised this gist May 8, 2013. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions gistfile1.ts
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,16 @@
    /// <reference path="./.node-definitions/node.d.ts" />

    //See the node typescript definition referenced above,
    //and needed for this example here: https://github.com/borisyankov/DefinitelyTyped
    /**
    * See the node.js TypeScript definition needed for this
    * example here: https://github.com/borisyankov/DefinitelyTyped
    */

    import Http = module('http');
    import Net = module('net');

    class MyServer {
    header : Object = {'Content-Type': 'text/plain'};

    private header : Object = {'Content-Type': 'text/plain'};

    constructor() {
    var server : Http.Server = Http.createServer(this.onRequest);
  5. prettymuchbryce created this gist May 8, 2013.
    23 changes: 23 additions & 0 deletions gistfile1.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    /// <reference path="./.node-definitions/node.d.ts" />

    //See the node typescript definition referenced above,
    //and needed for this example here: https://github.com/borisyankov/DefinitelyTyped

    import Http = module('http');
    import Net = module('net');

    class MyServer {
    header : Object = {'Content-Type': 'text/plain'};

    constructor() {
    var server : Http.Server = Http.createServer(this.onRequest);
    server.listen(3000);
    }

    private onRequest(request,response) {
    response.writeHead(200,this.header);
    response.end("hello TypeScript & node.js");
    }
    }

    var myServer = new MyServer();