Table of Contents
This project focusing on the REST API. This API is fully functional with filtering, pagination, sorting and selecting. It's fetching the data from the database and provide the products details, so you can able to use this data on the client side in your projects.
To get a local copy up and running follow these simple steps.
This is an example of how to list things you need to use the software and how to install them.
- npm
npm install npm@latest -g
- Get a MongoDB Atlas Application connection URL at https://www.mongodb.com/home by creating the database.
- Clone the repo
git clone https://github.com/Dharmik3/productsApi.git
- Install NPM packages
npm install
- Create
.env
file and put MongoDB url in.env
MONGO_URL = ENTER YOUR MONGO URL (without inverted commas);
- Run following command in terminal
npm start
Now you can test your url on your browser or postman with following url
http://localhost:4000/api/v1/products/
For more examples, please refer to the live link
If you wants to pass some query parameters then the following is the example
https://products-myg3.onrender.com/api/v1/products/?sort=name,-price&limit=5&select=name
Below are the query parameter which is passed in the form of key value pair
- select
- limit
- page
- sort
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Dharmik Patel - @dharmik - dharmikpatel.pepalla@gmail.com
Live Project Link: https://productsapi.up.railway.app/api/v1/products/