Built-in Modules
CalmAPI ships with some built-in Modules
- Auth
- User
- Media
- Post (Sample CRUD Module)
#
AuthCalmAPI 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#
LoginLogin response will contain token
and user
. A response will look like
Use the token for Bearer Auth.
#
Logout#
UserThis module contains mainly the user model. Controller & Route are not being used by default. You can use it if you want.
#
MediaThis module is for Uploading files. Currently, it only supports AWS S3.
#
AWS S3 ConfigurationJust define your ACCESS_KEY_ID, SECRET_ACCESS_KEY & BUCKET_NAME in .env
file and Boom!
#
Upload FileResponse 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#
PostPost 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 PostSample response
#
Get AllSample response
#
Get SingleSample response
#
Update SingleSample response
#
Delete SingleSample response