moleculer-project-web-store
First time using moleculer, especially moleculer-web.
Here's a Rest-API simulating a web store.
Features
- Rest-API
- HTTP requests
- Users management (Create & Modify)
- Products management (Create & Modify & Stock-management)
- Orders management (Create & Add-product & Quantity-product & Validate)
HTTP Requests
The following HTTP requests are based on the localhost IP Adresse, like it would be if you test this project in local:
Application
GET /status/server
Return the configuration of the server
GET /status/health
Return the node health
GET /status/database
Return the whole database instance
GET /status/reset
Reset the application (empty the database)
Users
POST /api/v1/user
Create a new user
Parameter | Type | Description |
---|---|---|
email |
String |
The email address of the new user |
firstname |
String |
The firstname of the new user |
lastname |
String |
The lastname of the new user |
GET /api/v1/users
Get all users that exist
Parameter | Type | Description |
---|---|---|
- | - | - |
Get a specific user from his email address
Parameter | Type | Description |
---|---|---|
email |
String |
The email address of the user |
:email/verify
GET /api/v1/user/Verify if a user exists from his email address
Parameter | Type | Description |
---|---|---|
email |
String |
The email address of the user |
Update a user information from his email address
Parameter | Type | Description |
---|---|---|
email |
String |
The email address of the user |
firstname |
String |
The firstname of the user |
lastname |
String |
The lastname of the user |
Products
POST /api/v1/product
Create a new product
Parameter | Type | Description |
---|---|---|
title |
String |
The name of the new product |
description |
String |
The description of the new product |
price |
Number |
The price of the new product |
GET /api/v1/products
Get all products that exist
Parameter | Type | Description |
---|---|---|
- | - | - |
:id_product
GET /api/v1/product/Get a specific product from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
:id_product/verify
GET /api/v1/product/Verify that a product exists from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
:id_product
PATCH /api/v1/product/Update a product information from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
title |
String |
The name of the product |
description |
String |
The description of the product |
price |
Number |
The price of the product |
:id_product/quantity_op/:quantity
PATCH /api/v1/product/Add or remove quantity of a product from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
quantity |
String |
The quantity you want to add (positive nbr) or remove (negative nbr) |
:id_product/increment
PATCH /api/v1/product/Increment a product's quantity from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
:id_product/decrement
PATCH /api/v1/product/Decrement a product's quantity from its id
Parameter | Type | Description |
---|---|---|
product_id |
String |
The id of the product |
Orders
POST /api/v1/order
Create a new order
Parameter | Type | Description |
---|---|---|
id_user |
String |
The id of a user linked to this order |
GET /api/v1/orders
Get all orders that exist
Parameter | Type | Description |
---|---|---|
- | - | - |
:id_order
GET /api/v1/order/Get a specific order from its id
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |
:id_user
GET /api/v1/order/user/Get all orders linked to a specific user from his id
Parameter | Type | Description |
---|---|---|
id_user |
String |
The id of the user |
:id_order/verify
GET /api/v1/order/Verify that an order exists from its id
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |
:id_order/product/:id_product
PATCH /api/v1/order/Add a product to an order
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |
id_product |
String |
The id of the product |
:id_order/product/:id_product/increment
PATCH /api/v1/order/Increment a product's quantity in an order
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |
id_product |
String |
The id of the product |
:id_order/product/:id_product/decrement
PATCH /api/v1/order/Decrement a product's quantity in an order. Remove the product from the order if it's quantity equal 0
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |
:id_order
PATCH /api/v1/order/Validate an order. The order will be locked and cannot be changed after validation
Parameter | Type | Description |
---|---|---|
id_order |
String |
The id of the order |