Fake Backend service of Rent A Car project for frontend tutorials.
To get a local copy up and running follow these simple steps.
- npm
npm install npm@latest -g
- Clone the repository:
git clone https://github.com/ahmet-cetinkaya-instruction/rent-a-car-fake-backend.git
- Change your directory in the terminal:
cd rent-a-car-fake-backend
- Install the required packages:
npm install
- Copy the
.env.example
file and rename it to.env
. - Edit the
.env
file and set the value of theJWT_SECRET_KEY
property to a random string of your choice.
npm start
-
CRUD operations: json-server routes
-
Auth operations:
Route | Comment | Body | Header | Return |
---|---|---|---|---|
auth/login | Login process to authenticate users | {userName: string, password: string} |
{success:boolean, access_token:string} |
|
auth/test | Test the validity of your access token | Authorization: "Bearer <access_token>" |
{success:boolean, message:string} |
|
auth/test-admin | Test if your access token has admin role | Authorization: "Bearer <access_token>" |
{success:boolean, message:string} |