- npm installed
- IDE eg vscode
- CLI eg postman
- Clone or Download repositry
- Setup .env file =>
port
,mongo_uri
,jwt _secret
- run
npm install
- run
npm start
Post-it is ready for use
For this API layered_structure
was abopted for the main purpose of creating
all the files in an order that could acomodate the rest easily. This structure was optimized
as scalable
and the best for the project decided by the developer.
Developer: "If I can get one path right, then the rest would be
cake
"
This feature was implemented by adding an extra attribute to the Postit model called deleted
Posts
{
"post": "Soft delete feature",
"ownerID": "640a12d5f6020fee349f8219",
"deleted": false // default: false
}
the delete http request
in the controller is set to PATCH
=> updates deleted attribute in the post to true.
Posts
{
"post": "Soft delete feature",
"ownerID": "640a12d5f6020fee349f8219",
"deleted": true
}
Joi Validation
Joi
validation was used as my schema validator
to validate all req.body
data sent sent by the user to match my model before being sent to controller.js for use.
JWT
jwt token
for login
authorization and specification too
installed
jsonwebtoken
Used postman environment to keep url paths neat and simple
- env name =>
DEV: TaskMate
- variable =>
USER
// {{USER}} - initial value =>
localhost:3838/api/v1/users/
Automate authorizstion setting by setting your `jwt_token` to this an _env variable_
All route endpoints stored in `try/catch` to hold asyn and sync errors
API probed to remain active under all circumstance.
Ready for Deployment
A special feature was adopted in this api, giving a unique avatar to all users with information drafter
from their provided details, this feature was made possible using dicebear api
to generate random avatars and return an avatar url
. Image Tag was included in the user model to hold a html
img tag for the avatar url.
img_tag: "<img src="${avatarUrl}" alt="Avatar image for profile picture" />"