Before running application locally make sure you have created and set the content of .env
file, please env.sample file for properties.
-
To install the dependencies use the following command.
npm install
-
To Run this app use the following command.
npm run start
-
To Run this app in the development mode, using nodemon use the following command.
npm run serve
Note: Change localhost to server ip if access from server
- Get All books
curl --location --request GET 'http://localhost:5000/book?pageNo=1' | json_pp
- Get book by id
curl --location --request GET 'http://localhost:5000/book/3'
- Create Book
curl --location --request POST 'http://localhost:5000/book' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Harry Potter",
"author":"J.K.Rowling",
"language":"English"
}'
- Update Book
curl --location --request PUT 'http://localhost:5000/book/5' \
--header 'Content-Type: application/json' \
--data-raw '{
"language":"English"
}'
- Delete Book
curl --location --request DELETE 'http://localhost:5000/book/3'
If you want to import to the POSTMAN rest client plase use this postman.json
docker build -t <username>/<image-name>:<tag> .
docker login --username=<username> --email=<email>
Password:
---------------------------------------------------------------------------------------------------------------
docker push <username>/<image-name>:<tag>
docker run -d -p 5000:5000 --name <image-name> <username>/<image-name>:<tag>