Skip to content

Instantly share code, notes, and snippets.

@metasansana
Created June 27, 2014 05:45
Show Gist options
  • Save metasansana/0c2d90406ea3fa333b1d to your computer and use it in GitHub Desktop.
Save metasansana/0c2d90406ea3fa333b1d to your computer and use it in GitHub Desktop.
//Here is a simple example. Pretend we are using express.
var app = express();
var config;
var db = new ConfigServerThing();
//This part is useless because the main loop exits before we call app.listen()
db.find(function(err, config) {
if(err) throw err;
config = config;
app.listen(3000);
});
app.get('/', function(req,res) {
if(config.SHOW_ROOT)
return res.send('root');
res.send(404);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment