AlpineBits DestinationData Server
This is a reference implementation for an AlpineBits DestinationData server.
The server exposes data from the OpenDataHub API in accordance to the AlpineBits format.
The current version of the server accepts HTTP GET requests on the following routes:
* These routes return dummy data, as they are not currently available on the OpenDataHub API.
To install the required dependencies, run:
Setup Environment Variables
The server requires an
.env file from which it loads general configurations.
You can reuse
.env.example or create your own.
cp .evn.example .env
The server must be connected to a PostgreSQL database. During development, the following commands can be used to get Docker instances of PostgreSQL and PgAdmin running, which will be configured with the variables setup on the
npm run db npm run pgadmin
The following commands can be then used to (i) create all necessary tables and views...
npm run create-tables
...(ii) insert default values (e.g., language codes, and standardized categories)...
npm run insert-defaults
... and (iii) to populate the database with data imported from the OpenDataHub API
npm run import-odh-data
To run the server, execute:
npm run server
We set up the server to listen to HTTP request on the port 8080.
To run the end-to-end tests, run:
npm run test
To deploy the server with Docker, run:
docker-compose build docker-compose start
The server needs to be running for these tests to be properly executed.
These commands must be executed from within the project's folder.
Please set the environment variables as you need within the '.env' file.
The whole test suite may take between 15 and 25 seconds to be executed, as it makes multiple HTTP requests to the OpenDataHub API.
For the tests, we are using the Jest framework.