Inventory App REST API made with ExpressJS
To run this API, follow the required steps below:
- Clone the repository:
git clone https://github.com/prammmoe/inventory-app-backend
- Install all dependencies using npm install
npm i
-
Copy
.env.example
and rename it to.env
and fill with your own credentials. -
Configure your db connection in
configs/db.js
-
Dump the data
dump_data_example.sql
on your local database -
Start the database server
-
Run the API
npm start
Sample response:
GET\ localhost:5000/products
{
"status": 200,
"error": false,
"message": "Successfully get all products data!",
"data": [
{
"id": 1,
"name": "Pembersih Wajah - Cerah Seketika",
"description": "Pembersih wajah lembut yang efektif membersihkan kotoran, minyak, dan makeup. Membuat wajah tampak lebih cerah dan berseri.",
"image": "pembersih_wajah.jpg",
"category": "Produk Kecantikan",
"quantity": 100,
"date_added": "2024-03-29T21:30:52.000Z",
"date_update": "2024-03-29T21:30:52.000Z"
},
{
"id": 2,
"name": "Toner Penyeimbang Kulit",
"description": "Toner yang menyegarkan dan menyeimbangkan pH kulit. Mempersiapkan kulit untuk produk selanjutnya agar lebih mudah menyerap.",
"image": "toner.jpg",
"category": "Produk Kecantikan",
"quantity": 80,
"date_added": "2024-03-29T21:30:52.000Z",
"date_update": "2024-03-29T21:30:52.000Z"
}
]
}
Using query params:
GET\ localhost:5000/products?limit=1
{
"status": 200,
"error": false,
"message": "Successfully get all products data!",
"data": [
{
"id": 1,
"name": "Pembersih Wajah - Cerah Seketika",
"description": "Pembersih wajah lembut yang efektif membersihkan kotoran, minyak, dan makeup. Membuat wajah tampak lebih cerah dan berseri.",
"image": "pembersih_wajah.jpg",
"category": "Produk Kecantikan",
"quantity": 100,
"date_added": "2024-03-29T21:30:52.000Z",
"date_update": "2024-03-29T21:30:52.000Z"
}
]
}
.
├── src
│ ├──configs
│ ├──controllers
│ ├──middleware
│ ├──routes
│ └──middleware
├──.gitignore
├──app.js
├──dump_data_example.sql
├──package-lock.json
├──package.json
└── README.md
- API Documentation
- Deployment