Closed mjreich closed 8 years ago
Proposing a couple of API changes:
//default partial version, wrapped in admin theme. Title is implicitly extracted from the last route segment using morph.
admin.page('/my-page', 'my-template-partial')
//Specify opts, like title, menu.
admin.page('/my-page', {title: 'My Page Title', label: 'Menu Label'}, 'my-template-partial')
//default handler version. If the return is a promise or a string, then the return is resolved rendered in the admin theme
admin.page('/my-page', () => {
return template.render('my-template', opts)
})
//route version. Next has to be explicitly called, or the res handled inside the handler.
admin.page('/my-route', {method: 'post'}, (req, res, next) => {
//do something
res.redirect('/admin')
})
AdminController
to extend EditController
, not MVCModule
- these are model-specific.
admin.page()
, but it feels like a mismatch still.admin.manage()
and new AdminController
- upgrade to a class for custom model route handlers etc is just to move that options object to the constructor super() call.routePrefix
and templatePrefix
and permissions-protected routes.
@loppear writing this up to gut check approach with regards to re-use of nxus-web.
Features
Approach
Questions