Skip to content

Instantly share code, notes, and snippets.

@tamg
Last active March 14, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamg/89608a2560357b3a45c4c0390911795d to your computer and use it in GitHub Desktop.
Save tamg/89608a2560357b3a45c4c0390911795d to your computer and use it in GitHub Desktop.
// requiring and invoking express returns to us an 'app' function
var express = require('express');
var app = express();
// port can be an environment variable or just 3000
var port = process.env.PORT || 3000;
// use the static middleware to serve static files from public folder
app.use('/assets', express.static(__dirname + '/public'));
// reponse function to fire after a get request to '/'
app.get('/', function(req, res) {
res.send('Hello World!')
});
// app.listen calls the standard Node http.createServer();
app.listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment