a user management and interactions REST API with accounts, user permissions and content management
git clone https://github.com/abdullahwaseem01/friendster-api.git
cd friendster-api
npm install
The following variables require declaration within src/.env
PORT=<PORT>
MONGODB_URI=<MONGODB URI>
JWT_SECRET=<STRING>
JWT_REFRESH_SECRET=<STRING>
ACCESS_TOKEN_EXPIRY=<SECONDS OR STRING DESCRIBING A TIME SPAN WITH VERCEL/MS>
npm start
JSON web tokens are used to authorize routes and are required to verify requests and return the corresponding privileges. Access tokens and refresh are assigned on post requests to the register route and can be passed as bearer tokens or passed within request queries and request bodies.
Access token expiries can be set via the environment variables. Once expired, access tokens can be refreshed by passing the refresh token to any protected route. As follows:
curl --location --request GET <domain>/<protected_route> \
--header 'Authorization: Bearer <refreshToken>'