API REST Examples for SQL (Postgres) and NOSQL (MongoDB)
The project is composed of two different APIs REST. One is based on a SQL database (Postgres) and the other on a NoSQL database (Mongodb).
It makes use of the Node ORM Sequelize. The schema is very simple, only three entities: User, Address and Tech. The one-to-many (User-Address) and many-to-many (User-Tech) relationships are covered. Each controller have all the CRUD operations and one controller more is added to make reports (ReportController), like listing users with gmail accounts living in a specific street and pointing in case they are attached to a technology starting with 'React%'.
It is neccessary to fill your database configuration at: sql-sequelize/src/config/database.js.
It makes use of the Node ORM Mongoose. The structure is again very simple: User, Task and Project. This API provides "forgot password" funcionality by sending by email a generated token to be used when changing the password. This token is stored at the database as well as one expiry time for security reasons (both will be checked at reset password function). Another security measure is the encryption of the password before being stored at the database (using bcrypt module). Finally, the tokens generated (with jwt module) are signed with the "secret" located at config/auth.json.