Skip to content

Instantly share code, notes, and snippets.

Last active Mar 14, 2017
What would you like to do?
// 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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment