This is an ExpressJS API service interface that sits between DHIS2 (data source) and the frontend. It is a middleware that handles:
- Simplifying requests & queries to DHIS API
- Cacheing/storage of commonly-used & large data chunks
- Pagination (splitting large data chunks for faster UI/frontend)
- Redundancy with cached data (limit calls to DHIS API)
- Offers options to replicate/extend use & implementation of the dashboard. Simply change the constants & configs & apply to another source program/DHIS2 instance
Eventually, this will be shipped along with with a React dashboard & packaged into a DHIS2 app. It will run concurrently with the React dashboard
- Clone this repository
$ git clone https://github.com/uonafya/gcd-middleware
- Navigate to project directory
$ cd gcd-middleware
- Create a
.env
file using the example given and edit it accordingly
$ cp .env.example .env
$ vi .env
- Install dependencies
$ npm install
- Start/run the server
$ npm run dev
The folder structure is as follows:
📦gcd-middleware
┣ 📂middleware
┃ ┣ 📂county
┃ ┣ 📂national
┃ ┣ 📜common.js
┃ ┗ 📜dashboard.js
┣ 📂routes
┃ ┣ 📂county
┃ ┣ 📂national
┃ ┣ 📜common.js
┃ ┗ 📜dashboard.js
┣ 📂utils
┃ ┣ 📜index.js
┣ 📜README.md
┣ 📜index.js
┣ 📜package-lock.json
┗ 📜package.json
Developed and maintained by USAID HealthIT for the Ministry of Health