A RESTful API for a private project. Handles a basic customers / orders approach.
- Dabase server:
docker run -p 27017:27017 -v /var/lib/mongodb:/data/db -v /var/lib/mongodb/cert:/data/cert --name mongo -d mongo mongod --auth --sslMode requireSSL --sslPEMKeyFile /data/cert/mongodb.pem
(you need to have a valid cert) - Node server:
docker-compose up --build
- Node.JS v8.4.0
- MongoDB v3.4.1
-
GET /customers
- Retrieves the list of customers as an array
-
POST /customers
- Creates a new customer. See
example_customer.json
for parameters. You can only use theprofile
parameters and they shall not be in aprofile
object.last_name
andfirst_name
are mandatory. - Example body:
{ 'first_name': 'John', last_name': 'Doe', 'age': 19 }
- Creates a new customer. See
-
GET /customers/{customerId}
- Retrieves the specified customer.
-
PUT /customers/{customerId}
- Updates the specified customer. See
POST /customers
for parameters.
- Updates the specified customer. See
-
DELETE /customers/{customerId}
- Deletes the specified customer.
-
GET /customers/{customerId}/orders
- Retrieves the orders of the specified customer.
-
POST /customers/{customerId}/orders
- Creates a new order for the specified customer. See
example_order.json
for parameters.amount
andtype
are mandatory. You must not specify_id
,customer_id
anddate
. - Example body:
{ 'type': 'Marriage', 'amount': 50, 'description': 'Was cool.' }
- Creates a new order for the specified customer. See
-
GET /orders
- Retrieves the list of orders as an array
-
GET /orders/{orderId}
- Retrieves the specified order.
-
PUT /orders/{orderId}
- Updates the specified order.
-
DELETE /orders/{orderId}
- Delete the specified order.