Built-in Modules
CalmAPI ships with some built-in Modules
- Auth
- User
- Media
- Post (Sample CRUD Module)
Auth#
CalmAPI ships with local Authentication & Authorization using JWT & Token Store.
For password encryption, bcrypt has been used.
Auth Module has these routes built-in, And yes you can add anything you want.
Implemented Methods
- Register
- Login
- Logout
- Auth Check Middleware [Bearer Token]
- Change Password
- Update Profile
- Get Profile
- Password Reset using OTP
Register#
Login#
Login response will contain token and user. A response will look like
Use the token for Bearer Auth.
Logout#
User#
This module contains mainly the user model. Controller & Route are not being used by default. You can use it if you want.
Media#
This module is for Uploading files. Currently, it only supports AWS S3.
AWS S3 Configuration#
Just define your ACCESS_KEY_ID, SECRET_ACCESS_KEY & BUCKET_NAME in .env file and Boom!
Upload File#
Response will contain path of the uploaded file. Add that to your bucket's base URL to access the file.
You can also store the _id in another collection's reference to populate the file information.
Delete File#
Post#
Post module is a sample CRUD module ships with CalmAPI which includes the following methods.
- Create Post
- Get All Posts with Pagination, filter & Sort
- Get Single Post by ID
- Update Single Post by ID
- Delete Single Post by ID
Create Post#
Sample response
Get All#
Sample response
Get Single#
Sample response
Update Single#
Sample response
Delete Single#
Sample response