#RESTful API for Glootie SPA. More about Express
- Open app's directory in CMD or Terminal
- Type
npm install
- Make new file a called .env, set up first here
- Turn on Web Server and MySQL can using Third-party tool like mamp, etc.
- Create a database with the name #nama_database, and Import file sql to phpmyadmin
- Open Postman desktop application or Chrome web app extension that has installed before
- Choose HTTP Method and enter request url.(ex. localhost:3000/)
- You can see all the end point here
Open .env file on your favorite code editor, and copy paste this code below :
DB_HOST=localhost
DB_USER=root
DB_PASS=root
DB_DATABASE= dbname
JWT_KEY=PASSWORD
PORT=3000
1. GET
/menu
(Get all product)/menu/:id
(Get product by id)/menu/search
(Search product)
2. POST
/menu
(Post product){ "category_id": 1, "menu_name": "Black Forest", "menu_price": 50000 , "menu_status" : 1 | 0, "menu_image":"img files"}
3. PATCH
/menu/:id
(Update product by id){ "category_id": 1, "menu_name": "Black Forest", "menu_price": 30000 , "menu_status" : 1 | 0, "menu_image":"img files"}
4. DELETE
/menu/:id
(Delete product by id)
1. GET
/category
(Get all category)/category/:id
(Get category by id)
2. POST
/category
(Post category){ "category_name": "Foods", "category_status" : 1 | 0}
3. PATCH
/category/:id
(Update category by id){ "category_name": "Foods", "category_status" : 1 | 0}
4. DELETE
/category/:id
(Delete category by id)
1. GET
/order
(Get all orders)/order/:id
(Get order by id)/order/this-week-order
(Get all orders this week)
2. POST
/order
(Post orders)[ { "menu_id": 4, "qty": 1 }, { "menu_id": 4, "qty": 1 } ]
1. GET
/history
(Get all History)/history/:id
(Get History by id)/history/today-total
(Get total todays income)/history/today-yearly
(Get total yearly income)/history/chart
(Get data for chart)
1. GET
-
/users
(Get all users) -
/users/:id
(Get user by id) -
/users/login
(Get user by id) -
{ "user_email": "@email", "user_password" : **** }
-
/users/register
(Post Register) -
{ "user_email": "@email", "user_password" : ****, "user_name": "username" }