nakamarusun / tset-xulfedon

This is the greatest xulfedon internship test of all time

Home Page:https://covidapi.jasoncoding.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xulfedoN internship assesment

Now with database caching!

demo

This assignment uses these libraries:

  • libasyik
  • json by nlohmann
  • Boost
  • SOCI

How to run

  1. To run you need to have docker installed

  2. Clone this repository

git clone https://github.com/nakamarusun/tset-xulfedon.git
cd tset-xulfedon
  1. Build the docker image
docker build --tag xulfedon-tset:0.1 .
  1. Create a docker volume to store the sqlite database
docker volume create covid-api-db
  1. 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

Features

  • 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.

Potential issues and limitations

  • 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.

Future Ideations

  • Middleware for HTTP servers
  • Last modified header from covid api

About

This is the greatest xulfedon internship test of all time

https://covidapi.jasoncoding.com/


Languages

Language:C++ 63.6%Language:CMake 23.5%Language:Dockerfile 11.5%Language:Shell 1.4%