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.
Create a simple server with express.js
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment