Last active
December 11, 2015 10:29
-
-
Save BoyCook/4587392 to your computer and use it in GitHub Desktop.
Node.js express server.js defaults
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
/* | |
Server app | |
*/ | |
var express = require('express'); | |
var app = express(); | |
var port = 3000; | |
app.configure(function () { | |
console.log('Doing [default] configure'); | |
app.use(express.static(__dirname + '/public')); | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser('appsecret')); | |
app.use(express.session({ secret: 'appsecret', cookie: { maxAge: 60000 } })); | |
app.use(app.router); | |
}); | |
app.get('/info', function(req, res){ | |
res.send('Info'); | |
}); | |
app.listen(port); | |
console.log('Listening on port [%s]', port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment