Skip to content

Instantly share code, notes, and snippets.

@BoyCook
Last active December 11, 2015 10:29
Show Gist options
  • Save BoyCook/4587392 to your computer and use it in GitHub Desktop.
Save BoyCook/4587392 to your computer and use it in GitHub Desktop.
Node.js express server.js defaults
/*
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