Skip to content
Snippets Groups Projects
Commit d45d4e12 authored by Joel Cavat's avatar Joel Cavat
Browse files

Update readme with two options

parent d28d6345
Branches
No related tags found
No related merge requests found
# TP MongoDB
## Start docker
### Option 1 (mongo containerized, node locally)
build and run MongoDB and Node.js API with `orders.json` dump:
```
......@@ -17,6 +24,14 @@ use mongodb (mongo shell):
docker-compose exec mongo-orders mongo admin
```
### Option 2 (mongo and node containerized)
```js
docker-compose -f docker-compose-with-node.yml up --build -d
```
## Use MongoDB
in mongodb shell:
```js
......@@ -46,12 +61,24 @@ db.orders.find().map( obj => obj.vendors );
```
## Serveur HTTP
## Use a HTTP Serveur (optional)
### Using node locally (option 1)
```js
cd api
npm install
npm start
```
API in Node.js available, example route http://localhost:3000/by-customer-pseudo/A**D
### Using node locally (option 2)
API in Node.js available, example route http://localhost:8080/by-customer-pseudo/A**D
API already available at http://localhost:8080/by-customer-pseudo/A**D
## Missions
# Missions
### Contraintes
......@@ -68,7 +95,8 @@ API in Node.js available, example route http://localhost:8080/by-customer-pseudo
6. pour chaque client (id et pseudo), comptez le nombre de commandes
7. pour chaque vendeur, comptez le chiffre d'affaire (indication: `$unwind`)
## Vos solutions
# Vos solutions
### requête 1
......
version: '2'
services:
mongo-orders:
image: mongo
ports:
- '27017:27017'
mongo-seed:
build: ./mongodb
depends_on:
- mongo-orders
api:
build: ./api
ports:
- '8080:8080'
depends_on:
- mongo-orders
......@@ -8,9 +8,3 @@ services:
build: ./mongodb
depends_on:
- mongo-orders
api:
build: ./api
ports:
- '8080:8080'
depends_on:
- mongo-orders
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment