Delivery API
This delivery API was built with Nodejs, Typescript and MongoDB. All routes for this api begin with https://delivery-api-l1dp.onrender.com
githubportfolio
Session Routes - /api/sessions
These routes handle the logging in and loggin out of users. The username and password is checked to ensure it matches what is present in the database, then an access token and refresh token is returned to the browser allowing the user to access restricted routes in the application. Some routes also require admin authorization. These routes can be identified when a 403 error is thown. To overcome this, please login the following admin user: {email: alejandrogarnacho@email.com, password: password}
post
Login user
Login a user by sending a post request to the session endpoint - /api/sessions
User Routes - /api/users
These routes handle everything user related. However, some of the routes are restricted to admin users only, and all routes need a user to be signed in before then can be used. You can start by creating a user, then heading to the sessions route and logging the user in before continuing with the rest of the app.
POST
create user
Create a user by sending a post request to the endpoint - /api/users
GET
Get users
Get all users by sending a get request to the endpoint - /api/users
GET
Get user
Get a user by sending a get request to the endpoint - /api/users/:id
Patch
Update User
Update a user by sending a patch request and data to the endpoint - /api/users/:id
Delete
Delete user
Delete a user by sending a delete request to the endpoint - /api/users
Product Routes - /api/products
These routes are protected routes, and so a user needs to be logged in before you are able to access them. They handle the creation, fecthing, updating, and deleting of products.
post
Create Product
Create a product by sending a post request and some data to the endpoint - /api/products
GET
Get Products
Get all products by sending a get request to the endpoint - /api/products
GET
Get product
Get a product by sending a get request to the endpoint - /api/products
Patch
Update product
Update a product by sending a patch request and data to the endpoint - /api/products
Delete
Delete product
Delete a product by sending a delete request to the endpoint - /api/products
Cart Routes - /api/carts
These routes handle everything cart related. However, some of the routes are restricted to admin users only, and all routes need a user to be signed in before then can be used. You can create a cart, update a cart (add products to cart), and delete a cart. All items added to the cart need to be already existing products. Here is one: product_73872ef3-e4bc-4659-868d-2562e42d9bae
post
Create Cart
Create a cart by sending a post request and some data to the endpoint - /api/carts
GET
Get carts
Get all carts by sending a get request to the endpoint - /api/carts
GET
Get cart
Get a cart by sending a get request to the endpoint - /api/carts
Patch
Update cart
Update a cart by sending a patch request and data to the endpoint - /api/carts
Delete
Delete cart
Delete a cart by sending a delete request to the endpoint - /api/carts
Order Routes - /api/orders
These routes handle everything order related. However, some of the routes are restricted to admin users only, and all routes need a user to be signed in before then can be used. You can create a order, update an order (mark as completed, or incomplete), and delete an order.