Discover Packages
github.com/ice777x/manager
command
module
Version:
v0.0.0-...-e2092d4
Opens a new window with list of versions in this module.
Published: Sep 10, 2024
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: ? modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
README
README
¶
MANAGER
Manager is a product and order management API coded in Go. This API provides a simple and efficient way to manage products and orders in a system.
📦 Features
Product Management: Add, update, delete, and retrieve product information.
Order Management: Create, update, delete, and retrieve orders.
⚙️ Installation
To install and run the project, follow these steps:
Clone the repository:
git clone https://github.com/ice777x/manager.git
cd manager
Set up your environment variables:
Create a .env file in the root directory and add the following:
DB_NAME=db_name
DB_USER=user
DB_PASS=passs
DB_HOST=host
Build the project:
go build
Run the project:
./manager
🚀 Usage
Once the project is running, you can use the following endpoints to interact with the API:
Users
POST /api/signup: Create a new user.
POTS /api/login: Login as user.
Products
GET /api/products: Retrieve all products.
GET /api/products?id=1,2,3: Retrieve a product by ID.
POST /api/products: Create a new product.
PUT /api/products/1: Update a product by ID.
DELETE /api/products?id=5,6: Delete a product by ID.
Orders
GET /api/orders: Retrieve all orders.
GET /api/orders?id=1,2,3,4: Retrieve an order by ID.
POST /api/orders: Create a new order.
PUT /api/orders/1: Update an order by ID.
DELETE /api/orders?id=4: Delete an order by ID.
Categories
GET /api/categories: Retrieve all orders.
GET /api/categories?id=1,2,3,4: Retrieve an order by ID.
POST /api/categories: Create a new order.
PUT /api/categories/1: Update an order by ID.
DELETE /api/categories?id=4: Delete an order by ID.
Customers
GET /api/customers: Retrieve all orders.
GET /api/customers?id=1,2,3,4: Retrieve an order by ID.
POST /api/customers: Create a new order.
PUT /api/customers/1: Update an order by ID.
DELETE /api/customers?id=4: Delete an order by ID.
Example Requests
Get a specific product:
curl http://localhost:3000/products?id=1
Example Response:
{
"result": [
{
"category": {
"id": 1,
"name": "Masonry & Precast"
},
"product": {
"id": 1,
"name": "Crawler",
"stock": 3273,
"price": 28496.33,
"image": "http://dummyimage.com/152x100.png/5fa2dd/ffffff",
"category_id": 1,
"created_at": "2024-07-30T10:49:37.984252Z"
}
}
],
"status": 200
}
Create a new product:
curl -X POST -H "Content-Type: application/json" -d '[{"name":"Çivi", "stock":99, "price":0.25, "image":"civi.jpg", "category_id":1}]' http://localhost:3000/products
{
"result": 2,
"status": 200
}
Update a product:
curl -X PUT -H "Content-Type: application/json" -d '{"name":"Updated Product Name", "price":150}' http://localhost:3000/products/8
{
"result": 8,
"status": 200
}
Delete a product:
curl -X DELETE http://localhost:3000/products?id=5,6,7
{
"result": [
5,
6,
7
],
"status": 200
}
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.