Skip to content

Instantly share code, notes, and snippets.

@iamtchelo
Created July 3, 2014 14:15
Show Gist options
  • Save iamtchelo/9a70e0e996fe09fcca34 to your computer and use it in GitHub Desktop.
Save iamtchelo/9a70e0e996fe09fcca34 to your computer and use it in GitHub Desktop.

Revisions

  1. iamtchelo created this gist Jul 3, 2014.
    17 changes: 17 additions & 0 deletions server.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    var express = require('express');
    var app = express();
    var port = process.env.PORT || 8080;

    // routes
    app.get('/test', function(request, response) {
    response.send('Test router!');
    });

    // router with params
    app.get('/hello/:name', function(request, response) {
    name = request.params.name;
    response.send('Hello ' + name);
    });

    app.listen(port);
    console.log('Magic happens on port ' + port);