This assignment uses these libraries:
- libasyik
- json by nlohmann
- Boost
- SOCI
-
To run you need to have docker installed
-
Clone this repository
git clone https://github.com/nakamarusun/tset-xulfedon.git
cd tset-xulfedon
- Build the docker image
docker build --tag xulfedon-tset:0.1 .
- Create a docker volume to store the sqlite database
docker volume create covid-api-db
- Run the container with the docker volume attached to it.
docker run -d -e PORT=8080 -p 8080:8080 -e DB_LOC="/var/docker_vol/covid.db" --mount source=covid-api-db,target=/var/docker_vol xulfedon-tset:0.1
- Database data caching. since historical COVID-19 (usually) does not change, there is little reason to refetch from the API everytime someone hits our API. Therefore, we store it in a SQLite database.
- Invalidate database entry. If we would like to, we can refetch the data in the database by an additional parameter.
- When getting data for month, or year, first we fetch the data, Then we insert it to the database. After that, the database is queried and we send the data to the user. This process can be faster if we fetch the data, then send the data immediately to the user while inserting the data to the db asynchronously using fibers.
- Middleware for HTTP servers
- Last modified header from covid api