COVID 19 API built using C++++ because it's C++ + Crow + COVID
I know there are many COVID APIs out there, but let me create my own (using C++, of course)
Below are some of the instructions on how to use this API or head to this Docs
Make sure you fullfil these requirements
- 🐁 C++ (11/14) yes I use this language dude 😭
- 🐦 Crow it helps me to survive the C++ world
- 🐳 Docker (optional) thanks you are here, dude 🐳 ("of course")
Follow these steps to install this API
-
Clone and go into the directory
git clone https://github.com/mhnaufal/kopid-api.git cd kopid-api
-
Configure CMake
cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/kopid-api -B/kopid-api/build -G "Unix Makefiles"
-
Build & Run
cmake --build build/ --config Debug --target main_app -j && ./build/main_app
-
Open up localhost:18080
-
Docker run
docker container run --name kopit-api -d -p 18080:18080 lohehe/kopit-api:latest
or you can use the other image
docker container run --name kopid-api -d -p 18080:18080 lohehe/kopid-api:latest
-
Open up localhost:18080
-
/
GET get all COVID 19 cases ✅ -
/yearly/<int:year>
GET get all COVID 19 cases in the given year ❌ -
/monthly/<int:year>/<int:month>
GET get all COVID 19 cases in the given month of the year ❌ -
/daily/<int:year>/<int:month>/<int:date>
GET get all COVID 19 cases in the give date ✅
Currently unit test need to be run manually and its still using Postman
- Be grateful that now we have Go and Rust
g++ main.cpp
command its good,Makefile
is great, butCMake
is awesome- I love when I compile, because I can have 5 minutes to do other useful things
- Segmentaution fault is our friend, but how we dealt with it is our enemy
- I need to reduce the number of layers in Dockerfile (but I've run out of internet data/quota)
- The most important thing is I learn how to build and run C++ application manually without help any IDE (but I use CMake automation from VSCode 😭)
Thanks to these awesome resources: