Hello guys !
I just started elixir a couple of days ago but I’m still a total beginner and I need your help to develop my API. Actually, I’m working on a project that must use a third party API (coinapi.io) to update some data in my database. Poison seems to be a good candidate to do that but my problem is that I have no clue how to do automatic http requests, I mean where (wich folder, doc) to write my automatic calls and how to make them automatic, let’s say one call each 5 minutes ?
Hello guys !
Elixir files can be anywhere within a mix projects
lib/ folder and will work, but it’s common convention to namespace modules by their relative paths.
There are various ways of calling functionality on a schedule from more OTP reliant using
Parent.Periodic, over cron like using
quantum or db driven using
Oban. You can also run your own logic with a genserver and e.g.
Thanks for the advices !
Just to be sure, how my new created file with my code in it can be used ? It’s automaticly used or do I need to call it somewhere (if so where) ?
You probably mean httpoison, poison is a json decoder/encoder
It depends… if You use a gen_server, You need to start it in the supervision tree. Otherwise what You put in lib should be available once compiled…