- Docker
- Docker-compose
- Clone this repository
- Run the next commands in the root directory (same as docker-compose.yml)
$ docker-compose build- To run the backend server use:
$ docker-compose up- Use this command to stop the backend server
$ docker-compose down- To run the frontend server run this commands in the
clientdirectory:
$ npm install
$ npm run devWhile the backend server is running:
- Open new terminal and use this commands to launch the tests
$ sudo docker exec -i -t server /bin/bash
$ npm testOpen data from the administration can be use. Here you can test it thanks to this script which will use caracteristiques_2016.csv in root directory to fill the database.
To run this script and fill the database, follow the next instructions:
- open a terminal and attach it to the backend container using:
$ sudo docker exec -i -t server /bin/bash- run the next command in the server directory (you might see a file called caracteristisques_2016.csv):
node fillthedataba.jsThe database will be auto filled. To display this data in the frontend, you can use the button afficher les anciennes données in the bottom left.
Retrieve accidents for a given area.
- lat : latitude
- lon : longitude
- rad : radius
[
{
"id": "1235ae46b",
"loc": [ 10.25154, 40.25544], //loc is [longitude, lattitude] couple
"placeName": "Place saint jean",
"seriousness": 3,
"date": "2018-02-15T14:24:02.216Z"
}
]Create a new accident
{
"loc": [10.25154, 40.25544], //loc is [longitude, lattitude] couple
"placeName": "Place saint jean",
"seriousness": 2
}{
"id": "eb1235a46",
"loc": [10.25154, 40.25544], //loc is [longitude, lattitude] couple
"placeName": "Place saint jean",
"seriousness": 3,
"date": "2018-02-15T14:24:02.216Z"
}Delete an accident from the database
If everything is OK:
{
"n": 1,
"ok": 1
}If the id is not found: status 404
{
"message": "not found, not deleted Ehhhré :D"
}Retrieve comments for a given accident
- accident_id : the accident to get the comments.
[
{
"id": "ab121654",
"user_id": "b1564aa8",
"title": "omg very dangerous",
"message": "Be very carreful it is really dangerous ! Oh my god !",
"date": "2018-02-15T14:24:02.216Z"
},
{
"id": "ae1214584",
"user_id": "a157897bb48",
"title": "chill bill",
"message": "It's cool man, chill !",
"date": "2018-02-15T14:24:02.216Z"
}
]Post a comment for a given accident
{
"title": "omg very dangerous",
"message": "Be very carreful it is really dangerous ! Oh my god !"
}{
"id": "ae1214584",
"user_id": "ab15648",
"title": "omg very dangerous",
"message": "Be very carreful it is really dangerous ! Oh my god !",
"date": "2018-02-15T14:24:02.216Z"
}Retrieve accident for a given id
- accident_id : the accident to get.
{
"id": "eb1235a43",
"loc": [43.6237776, 7.0473906],
"placeName": "Route des Dolines",
"seriousness": 3,
"date": "2018-02-15T14:24:02.216Z"
}- Postman (https://www.getpostman.com/) : tool for test ours API by sending requests.
- Mongo Compass (https://www.mongodb.com/products/compass) : tool for visually explore ours data and manipulate it as necessary.
- Work on server side :
- API
- data storage in a NoSQL database (MongoDB)
- people access manager
- tests
- Work on client side
- Work on server side :
- open data parser
- data filter and cleaner
- data storage in a NoSQL database (MongoDB)
- tests
- Work on client side
- Work on client side :
- data display
- user interface (users and managers)
- accidents and comments manipulation
- real-time mode
- Work on server side