U s e r s - R o u t e s

By log in you can add, edit and remove your own toys , Admin has the ability to delete and modify users and their toys.

D o m a i n : https://new-toy.onrender.com

#Method URL Body Description
GET /users/myInfo none Get your own info - by token.
GET /users/usersList none Get list of all users - by token admin.
POST /users
                {
                  "name": "hadas",
                  "email": "Hadasmar014@email.com",
                  "password": "HADAS213"
                  }
Add a new user to the data base ,if you want to see the template of valid user.
POST (login) /users/login
                {
                  "email": "Hadasmar014@email.com",
                  "password": "HADAS213"
                  } 
User login, if the email and password are correct the server will respond with a token,
if you want to see the template of valid user.
DELETE /users/{idDel} Delete a user from the data base. Admin token can delete every user , and user can delete only himself.
PUT /users/{idEdit}
{
"name": "hadas",
"email": "Hadasmar014@email.com",
"password": "HADAS213"
}
                             
Update your user in the data base, Admin token can edit every user data , and user can edit only himself.

T o y s - R o u t e s

Some "GET" requests you can get information about the API, By adding these queries you can see the edit

  • Per-Page : you can select the amount of obj per one page.
  • Page : you can select the num of pages you want.
  • Sort : you can select how to make your sort - by Price / ID / Name / Cat.
  • Reverse : you can choose the sort dirction.

D o m a i n : https://new-toy.onrender.com

#Method URL Body Description
GET /toys none Get a list of all the toys, will present 10 results per page.
GET /toys/search?s=doll none search for a toy by searching follwing name or info after the "s=", it will present 10 results per page.
GET /toys/prices?min=50&max=200 none Get a list of the toys by min & max , it will present 10 results per page.
GET /toys/category/:catName none Get a list of all the toys in toys category, it will present 10 results per page.
POST /toys

{
"name":"Fish Game Doll",
"info":"Fish,Doll",
"category":"Doll",
"img_url":"Fish.jpg" ,
"price":25
}
                                
                              
   
Add a new toy to the data base, You need a token for this query ,
if you want to see the template of valid toy
PUT /toys/ID
{
"name":"Fish Game Doll",
"info":"Fish,Doll",
"category":"Doll",
"img":"Fish.jpg" ,
"price":25
}
   
Update a toy in the data base,You need a token for this query.
DELETE /toys/ID none Delete a toy from the data base, You need a token for this query.