abdullahwaseem01 / friendster-api

a user management and interactions REST API with user accounts, user permissions and user content management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Friendster-API

a user management and interactions REST API with accounts, user permissions and content management

Registration Example

Usage

Clone repository

git clone https://github.com/abdullahwaseem01/friendster-api.git
cd friendster-api

Install dependencies

npm install 

Environment Variables

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>

Run API

npm start

Authorization

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>'

About

a user management and interactions REST API with user accounts, user permissions and user content management


Languages

Language:JavaScript 100.0%