A minimalist applicaton for easing the tasks of vegetable businesses.
This document provides an overview of the API endpoints available in the VegetableShop application. The API is organized into several routes, each handling different aspects of the application such as user management, admin operations, and order processing.
Api docs
- URL:
/auth - Method:
POST - Description: Authenticates an admin user.
- Request Body:
{ "username": "admin", "password": "password" } - Response:
200 OKon successful authentication.403 Forbiddenon failed authentication.
- URL:
/user/create - Method:
POST - Description: Creates a new user.
- Request Body:
{ "username": "user", "email": "user@example.com", "password": "password" } - Response:
201 Createdon successful user creation.500 Internal Server Erroron failure.
- URL:
/user/auth - Method:
POST - Description: Authenticates a user.
- Request Body:
{ "username": "user", "password": "password" } - Response:
200 OKon successful authentication.403 Forbiddenon failed authentication.
- URL:
/user/delete - Method:
GET - Description: Deletes a user.
- Query Parameters:
id(string): The ID of the user to delete.
- Response:
200 OKon successful deletion.500 Internal Server Erroron failure.
- URL:
/user/logout - Method:
GET - Description: Logs out the current user.
- Response:
200 OKon successful logout.500 Internal Server Erroron failure.
- URL:
/user/order - Method:
POST - Description: Creates a new order.
- Request Body: Order details.
- Response:
201 Createdon successful order creation.500 Internal Server Erroron failure.
- URL:
/user/cancelOrder - Method:
GET - Description: Cancels an order.
- Query Parameters:
orderId(string): The ID of the order to cancel.
- Response:
200 OKon successful cancellation.500 Internal Server Erroron failure.
- URL:
/user/test - Method:
GET - Description: Test endpoint to check user authentication status.
- Response:
200 OKwith user details and authentication status.
- URL:
/admin/cSUAD - Method:
POST - Description: Creates a new admin user.
- Request Body: Admin details.
- Response:
201 Createdon successful admin creation.500 Internal Server Erroron failure.
- URL:
/admin/orders - Method:
GET - Description: Retrieves all orders.
- Response:
200 OKwith order details.500 Internal Server Erroron failure.
- URL:
/admin/dashboard - Method:
GET - Description: Retrieves admin dashboard data.
- Response:
200 OKwith dashboard data.500 Internal Server Erroron failure.
- URL:
/admin/logout - Method:
GET - Description: Logs out the current admin.
- Response:
200 OKon successful logout.500 Internal Server Erroron failure.
- URL:
/admin/delete - Method:
GET - Description: Deletes an admin user.
- Query Parameters:
id(string): The ID of the admin to delete.
- Response:
200 OKon successful deletion.500 Internal Server Erroron failure.
- URL:
/admin/uploadProduct - Method:
POST - Description: Uploads a new product.
- Request Body: Product details and image file.
- Response:
201 Createdon successful product upload.500 Internal Server Erroron failure.
- URL:
/admin/updateProduct - Method:
POST - Description: Updates an existing product.
- Request Body: Updated product details.
- Response:
200 OKon successful product update.500 Internal Server Erroron failure.
- URL:
/home/auth - Method:
POST - Description: Authenticates a user.
- Request Body:
{ "username": "user", "password": "password" } - Response:
200 OKon successful authentication.403 Forbiddenon failed authentication.
This document provides a comprehensive overview of the API endpoints available in the VegetableShop application. Each endpoint is described with its URL, method, description, request body, and response details.