Mongodb (v4 checked)
sudo apt-get install mongodb
The database has to have a couple of indexes, to make sure the queries don't take forever. See the dedicated repo (convert-ecodata-to-datahost)
## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.
To view the Swagger UI interface:
open http://localhost:8088/v1/docs
### Running the server
To run the server locally, run:
npm start
# production mode
install pm2 to run background apps
sudo npm install pm2 -g
run one app in the background
pm2 --name datahost-api-server start npm -- start
list processes :
pm2 ps
kill one
pm2 delete 0
This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work.
### local version
npm -v
=> 8.10.0
node -v
=> v12.22.12
### additional modules required
npm install mongodb
npm install @turf/turf
## for csv
npm install flat
npm install json2csv
### for the species script ###
create folder public/speciesFiles
* Requirements
npm install https npm install fs
* Run to create the public json species files in public/speciesFiles
mkdir -p public/speciesFiles npm run species
### for generating the YAML file ###
Before using the swagger editor for generating the server files or the client files, the yml file is needed.
The basefile is *templateOpenapi.yaml*, shared between the different datahost.
The parameters that can be changed are the ones with the caracters %%
THe file specificLU_endpoints contains specific elements for LU.
to generate the new openapi.yml file
npm run yamlgen
### generate the new files from https://editor.swagger.io/
visit https://editor.swagger.io/, copy-paste your open-api.yaml and check/fix the errors
Then generate server (nodejs-server)
download the result. browse through the files to get the methods needed.