Last active
March 14, 2017 20:57
-
-
Save tamg/89608a2560357b3a45c4c0390911795d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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