alcea
v0.0.2
Published
model loader, route loader & security manager. Work in progress
Downloads
1
Readme
Alcea auto loader (Work in progress...)
##Roadmap - update project to enable user to add personnal routingConfig file. - permit to override ensureAuthorized method
##Exemple de conf (default)
alcea.configure({
api_folder_path: 'server/api',
api_end_point: 'endpoint',
auto_discover: false,
security: {
passport: false
},
logger: {
enable: true,
level: 'INFO'
}
});
##Archi Project /server /api /module1 config.json /routes post.js /controllers post.js /models post.js comment.js tag.js /endpoint . . .
##config.json { "name": "blog", "version": "0.0.1", "private": true, "routes": [ "post.js" ], "controllers": [ "posts" ], "models": [ "post.js", "comment.js", "tag.js" ] }
##Bootstrap models alcea.loadModels();
##Bootstrap routes alcea.loadRoutes(); alcea.registerRoutes(app, express);
##Override security method alcea.loadRoutes(); alcea.overrideEnsureAuthorized(function(req, res, next) { console.log(alcea.loadedRoutes); console.log(alcea.routingConfig); return res.send(200, {"loadedRoutes": alcea.loadedRoutes, "routingConfig": alcea.routingConfig.userRoles }); }); alcea.registerRoutes(app, express);