Below are the routes for the Store API. The API provides various endpoints to manage user authentication, shopping cart, orders, and sneaker inventory. The routes are categorized based on their functionality.
- Description: Register a new user with the provided details (username and password).
- Controller:
registerController
- Description: Authenticate the user with their credentials (username and password) to obtain an access token.
- Controller:
loginController
- Description: Get the shopping cart items for the authenticated user.
- Middleware:
verifyUser
- Controller:
getUserCart
- Description: Add a sneaker to the shopping cart for the authenticated user.
- Middleware:
verifyUser
- Controller:
addToCart
- Description: Remove a sneaker from the shopping cart for the authenticated user.
- Middleware:
verifyUser
- Controller:
removeFromCart
- Description: Get the orders for the authenticated user.
- Middleware:
verifyUser
- Controller:
getUserOrders
- Description: Create a new order for the authenticated user.
- Middleware:
verifyUser
- Controller:
createOrder
- Description: Get all available sneakers.
- Middleware:
verifyUser
- Controller:
getSneaker
- Description: Get a specific sneaker by its ID.
- Middleware:
verifyUser
- Controller:
getSneakerById
- Parameters:
id
: String (required) - The ID of the sneaker to retrieve.
- Description: Add a new sneaker to the inventory.
- Middleware:
verifyUser
- Controller:
addSneakers
- Description: Add multiple sneakers to the inventory.
- Middleware:
verifyUser
- Controller:
addMultipleSneakers
- Description: Update an existing sneaker in the inventory.
- Middleware:
verifyUser
- Controller:
updateSneakers
- Description: Delete a sneaker from the inventory.
- Middleware:
verifyUser
- Controller:
deleteSneakers
- Parameters:
id
: String (required) - The ID of the sneaker to delete.
- Description: Get the details of the authenticated user.
- Middleware:
verifyUser
- Controller:
getUser
- Description: Get the shopping cart items for the authenticated user.
- Middleware:
verifyUser
- Controller:
getUserCart
- Description: Update the details of the authenticated user.
- Middleware:
verifyUser
- Controller:
updateUser
- Description: Delete the authenticated user.
- Middleware:
verifyUser
- Controller:
deleteUser
To access most of the routes, you need to be authenticated with a valid token. The token is obtained during registration or login and should be included in the headers of your requests as shown in the Authentication section.
The verifyUser
middleware ensures that only authenticated users can access protected routes. If the token is invalid or not provided, the middleware will return a 401 Unauthorized error, prompting the user to log in again.
Happy shopping! 🛍️