Skip to content

Instantly share code, notes, and snippets.

@wombleton
Created October 31, 2012 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wombleton/3990618 to your computer and use it in GitHub Desktop.
Save wombleton/3990618 to your computer and use it in GitHub Desktop.
var express = require('express'),
app = express();
app.configure(function() {
app.use(express.bodyParser());
});
/**
*/
app.get('/', function (req, res) {
res.redirect('/setup');
});
/**
*/
app.get('/setup', function (req, res) {
res.sendfile('static/setup/index.html');
});
/**
*/
app.post('/setup/password', function (req, res) {
var passwd = req.param('value');
var confirm = req.param('confirm');
console.log(req.body);
process.stderr.write(passwd + ' / ' + confirm + '\n');
});
/**
*/
var fatal = function (_message, _exception) {
process.stderr.write('fatal: ' + _message + '\n');
process.exit(1);
}
/**
*/
var main = function (_argv) {
try {
app.listen(80);
process.setuid('concierge');
} catch (e) {
fatal("Couldn't bind socket for listening on port 80", e);
}
}
main(process.argv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment