This API allows authenticated users to post their products online for other users to search and find products of needs. This app is meant for users to store any item inside a database
To install Product API on your local machine, clone the repo, open your terminal, navigate to the directory you just created, and do the following:
npm install
from there, you can start the server by doing one of these:
npm start
Great
All you'll have to do next is send a POST request to http://localhost:3000/user/signup
First set the header to Key: Content-Type and value: application/json Make sure your Body is JSON Type and selected raw and enter:
email: String,
password: Password
Then we will take care of the rest
In order to log in, send a POST request to http://localhost:3000/user/login
Use the following headers with the correct data types:
email: String,
password: Password
You should now be authenticated. You can check with the route below.
The system will log you out with in a hour
Before grabbing data from the API, all routes are authorized, except for get all proudcts request. In order to have access to all routes: Login and copy the token key Go to Headers enter Key: Authorization For Value: type Bearer and paste your personal token. This will check for user Authorization
Send a GET Request on http://localhost:3000/products/
and all products will be returned in the order they were made.
Send a GET Request on http://localhost:3000/products/:enterIdHere
to recieve the Product with ID you specified.
Send a POST request on http://localhost:3000/products/
and refer to following for names and values:
name: String,
price: Number,
Great.
You Can also upload images to your product if you click form-data and enter key and value, for example:
name: String,
price: Number,
productimage: Upload Image
Send a PATCH request to http://localhost:3000/products/
and refer to following for names and values:
id: String,
name: String,
price: Number,
Perfect.
Send a DELETE request to http://localhost:3000/puppies?_method=DELETE
and refer to following for names and values:
id: String;
Send a GET Request on http://localhost:3000/orders/
and all products will be returned in the order they were made.
Send a GET Request on http://localhost:3000/orders/:enterIdHere
to recieve the order with ID you specified.
Send a POST request on http://localhost:3000/orders/
and refer to following for names and values:
name: String,
price: Number,
Send a PATCH request to http://localhost:3000/orders/:enterIdHere
and refer to following for names and values:
id: String,
name: String,
price: Number,
Perfect.
Send a DELETE request to http://localhost:3000/orders/:enterIdHere
and refer to following for names and values:
id: String;
Thank you