This API is built using nodejs/express to access the OSPO_Database. The OSPO Database and resources are more clearly described in the Curvenote JupyterBook here.
The API is currently constructed with embedded version v1.0. The individual functions for the API are within the route-set in v1.0/routes/data.js structured around SQL queries that access the database.
The SQL to build the database can be found in the OSPO_Database repository.
The database connection is managed in the ./database/pgp_db.js file, using environment variables. Within the larger project this is managed through a docker-compose.yml, but it can be managed locally using a .env file with parameters that match with the parameters required to connect to the Postgres Database:
RDS_HOSTNAME
RDS_USERNAME
RDS_DATABASE
RDS_PASSWORD
RDS_PORT
SSL_CERT
TIMEOUT
The API is built using node.js and express.js using yarn as a package manager. To initialize the API, first, clone the repository:
git clone [email protected]:UW-Madison-DSI/OSPO_API.gitThen, move to the containing folder and run:
yarn installAt this point the packages used in the API will be installed locally and you can run the API using:
yarn run devThe dockerfile api.Dockerfile is intended to provide a reproducible container environment for the API, either to run the API locally, or as part of a Docker Compose object.