The templates are stuctured by Router-Controller-Model patterm
- contollers/
- exceptions/
- models/
- routes
-
- All the route logic goes
- Files are named as
<function>-contoller.js
-
- All the errors are handled by the
error.js
file - define the default error template
- The naming is based on the
<function>-controller.js
- Each controller has specific
Error
classes also
- All the errors are handled by the
class <function>Error extends Error {
constructor(message) {
super(message);
this.status = 401;
this.code = "UNAUTHORIZED";
this.error = "ValidateError";
this.msg = message;
}
}
-
- All the DB based operations are abstracted to this folder.
- Also the naming is based on the
<function>-model.js
-
- All the application routes are defined over here
- Naming
<function>-routes.js
, uses express router
$ mocha test/*-test.js
- with Siv S