Skip to content

Instantly share code, notes, and snippets.

@k1r0s
Created March 22, 2017 08:16
Show Gist options
  • Save k1r0s/d0110955a58b3f47957c3f9a3e482fa5 to your computer and use it in GitHub Desktop.
Save k1r0s/d0110955a58b3f47957c3f9a3e482fa5 to your computer and use it in GitHub Desktop.
Controller = Class({
constructor: function(app){
app.get('/', this.home);
app.get('/login', this.login);
app.use(this.notFound);
},
login: [function(req, res){
//what ever
}, "log"],
home: [function(req, res){
res.setHeader('Content-Type', 'text/plain');
res.end('Home');
}, "log"],
notFound: [function(req, res){
res.setHeader('Content-Type', 'text/plain');
res.send(404, 'Page introuvable !');
}, "log"]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment