- Clone this repo
git clone https://github.com/JusticeBringer/golden-book-bookstore-api.git
- Install required dependencies
npm i
- Start, in this order,
mongod
andmongo
processes - Add a
.env
file withNODE_ENV=development
- Add a
.env.development
and fill in the variables similar to the.env.development.example
file - Run
npm run start_local
- Navigate to
http://localhost:3000
to see successful launch
Please note that this is the server of the web app „Golden Book” Bookstore.
Root path: /api/v0
'/catalog/books'
'/payments/offline'
'/orders'
'/'
/:id
'/user'
'/register/confirmation/:token'
'/register/email'
'/register/google'
'/login/email'
'/login/google'
Example of books route: https://golden-book-bookstore-api.herokuapp.com/api/v0/catalog/books
Navigating to that link will give Access Denied
because you need to have a JWT
authorization token.
This JWT
token is given to each user whenever they access the web app and make a request.
The JWT
token is verified and then the request is being processed.
This is a begginner implementation to protect API infrastructure from unwanted requests.
The JWT
token can be set in the .env
file at variable called SECRET_JWT_TOKEN
.
After you set that variable, open Postman
or something similar, go to Headers
and add Authorization
key to the value of the SECRET_JWT_TOKEN
.
Inside scripts
folder, there is a file called resetMockedData.ts
. Whenever you want to reset the mocked data, set the RESET_MOCKED_DATA
variable inside .env
file to true
and then back to false
.
- Node.js, Express, MongoDB, Typescript
API hosted on Heroku here
The web app is also hosted on Heroku here
- Me - Gabriel Arghire 100%
License of this project is GNU GPL v3