GithubHelp home page GithubHelp logo

kopid-api's Introduction

Kopit 19

COVID 19 API built using C++++ because it's C++ + Crow + COVID

About

I know there are many COVID APIs out there, but let me create my own (using C++, of course)

Getting Started

Below are some of the instructions on how to use this API or head to this Docs

Prerequisites

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")

Installation

Follow these steps to install this API

Manual (Recommended)

  1. Clone and go into the directory

    git clone https://github.com/mhnaufal/kopid-api.git
    
    cd kopid-api
  2. 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"
  3. Build & Run

    cmake --build build/ --config Debug --target main_app -j && ./build/main_app
  4. Open up localhost:18080

Docker

  1. 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
    
  2. Open up localhost:18080

Endpoints

  • / 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 โœ…

Unit Tests

Currently unit test need to be run manually and its still using Postman

What I learned from this Project

  1. Be grateful that now we have Go and Rust
  2. g++ main.cpp command its good, Makefile is great, but CMake is awesome
  3. I love when I compile, because I can have 5 minutes to do other useful things
  4. Segmentaution fault is our friend, but how we dealt with it is our enemy
  5. I need to reduce the number of layers in Dockerfile (but I've run out of internet data/quota)
  6. 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 ๐Ÿ˜ญ)

Acknowledgments

Thanks to these awesome resources:

kopid-api's People

Contributors

imgbotapp avatar mhnaufal avatar naufalpratama1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.