Using C to expose R package estimateCVRisk to REST API. Writing this just for fun without all error handling that needed, please don't use in production environment. Other examples about using C to call R function could find here.
Building container:
sudo docker build -t [image tag] .Using container:
sudo docker run -d -p [host port]:[api port] [image tag] [api port]nerdctl and podman are ok too.
API test command:
curl -X POST -d '@[payload file name with path]' -H "Content-Type: application/json" http://[IP]:[api port]If someone would like to compile this, could follow Dockerfile to setup environment. However, C stack warning message might show, the following command could temperately set to unlimited on debian-like.
sudo prlimit --stack=unlimited --pid $$; ulimit -s unlimited