METHOD | ENDPOINT | REQUEST BODY & PARAMS | RESPONSE |
---|---|---|---|
GET | http://localhost:3001/api/users | List of all users | |
GET | http://localhost:3001/api/users/:id | id of the user && NEED AUTH | List Single user |
POST | http://localhost:3001/api/users/ | {email, userName, firstName, lastName, password} && NEED AUTH | Created user |
POST | http://localhost:3001/api/users/login | { email, password } | Authenticated User |
METHOD | ENDPOINT | REQUEST BODY & PARAMS | RESPONSE |
---|---|---|---|
GET | http://localhost:3001/api/products/ | List of all products | |
GET | http://localhost:3001/api/products/:id | id of the product | List Single product |
POST | http://localhost:3001/api/products/ | NEED AUTH && { name, prcie, category } | Created product |
METHOD | ENDPOINT | REQUEST BODY & PARAMS | RESPONSE |
---|---|---|---|
GET | http://localhost:3001/api/orders/1/find | NEED AUTH && user id | List of all orders for the user |
POST | http://localhost:3001/api/orders/1/create | NEED AUTH && user id | Created order |
POST | http://localhost:3001/api/orders/1/create-product | NEED AUTH && user id && { order_id, product_id, product_quantity } | Added product order record |
- id
- name
- price
- category
- id
- firstName
- lastName
- password
- id
- id of each product in the order
- quantity of each product in the order
- user_id
- status of order (active or complete)
id | fisrtname | lastname | password |
---|
` id SERIAL PRIMARY KEY, email VARCHAR(255) UNIQUE, firstName VARCHAR(100), lastName VARCHAR(100), password VARCHAR(255) `
id | name | price | category |
---|
` id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, price integer NOT NULL, category VARCHAR(255) `
id | user_id | order_status |
---|
` id SERIAL PRIMARY KEY, user_id bigint REFERENCES users(id), order_status VARCHAR(15) DEFAULT 'active'`
id | order_id | product_id | product_quantity |
---|
` id SERIAL PRIMARY KEY, order_id bigint REFERENCES orders(id), product_id bigint REFERENCES products(id), product_quantity integer`