Last active
December 10, 2015 21:38
-
-
Save oeeckhoutte/4496322 to your computer and use it in GitHub Desktop.
[Node] Simple Node.js Server using Express 3.0
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express'); | |
var app = express(); | |
// Configuration | |
app.configure(function(){ | |
app.use(express.bodyParser()); | |
app.use(express.methodOverride()); | |
app.use(express.static('www')); | |
}); | |
app.configure('development', function() { | |
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | |
}); | |
app.get('/hello', function(req, res) { | |
res.send('Hello World'); | |
}); | |
app.configure('production', function(){ | |
app.use(express.errorHandler()); | |
}); | |
app.listen(3000); | |
console.log("Express server listening on port 3000"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment