Skip to content

Instantly share code, notes, and snippets.

@daslicht
Created August 22, 2012 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save daslicht/3427267 to your computer and use it in GitHub Desktop.
Save daslicht/3427267 to your computer and use it in GitHub Desktop.
//in main app:
require('./routes').init(app);
//index.js in folder /routes
module.exports =
{
init:function(app){
require('./create')(app);
require('./read')(app);
require('./update')(app);
require('./delete')(app);
require('./home')(app);
}
}
//create.js in the /routes folder
module.exports = function(app){
app.get('/create',
function(req, res)
{
res.render('create', { title: 'Create' });
}
);
app.post('/create', function(req, res)
{
res.render('create', { title: 'Done' });
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment