Learn how Chartbrew backend works
server/models
:
Brew
is the model name and name
is a string attribute.
Important! make sure that the generated migration contains all the fields created in the model.
Check the other models to learn how to create associations.
Code style used by the models:
Brew
model.
Brew
example below:
api/index.js
file in order for the application to see them.
Below is an example of a brew route that uses the controller created above with some explanations about the code style guide.
index
file:
Authorization
header must be set to include a valid token
/user/login
with a valid email
and password
will return the token in the response.
In order to add authorization checks to the routes, the verifyToken
middleware can be used in the routes like so:
modules/accessControl.js
. It is important to note that most of these roles are from the team perspective. So for example if a chart "read:any"
permission is given to a user, this user can read any
charts from the team
that user is in only.
Below you can see an example on how to protect resources based on permissions and roles.
api
folder. Have a look at the ExpressJS documentation on Middleware for more details.