What route should I take to build this web service API with plumber?

plumber

#1

I have a personal project in which I want to create an API hosted on some server (my current personal preference is Digital Ocean). The desired API will take a string as input (the register code, called CNPJ, of a given Investment Fund in Brazil) and return a number (the current price of the fund).

Please see the code here. In summary, the first lines download the latest csv file from this page, which is usually around 20MB (too big to include downloading it on the API function, retornar_quota). It seems that my best alternative is to schedule a script to download that csv file everyday, save it on a local file in the same server as the API is hosted and have the API code read it from there.

I have read the plumber documentation about hosting so I'm aware of how I could go about creating an API from a simple function with no external dependency, but I don't know how I would create an API that depends on a local csv file.


#2

Perhaps this example will help?