Our great sponsors
-
But not all hope is lost, we have the ability to use custom buildpacks to support it ourselves. And there is one already available that Akash Manohar and his contributors built for us.
-
For this app, we'll use the public API of Coindesk to query the price of Bitcoin today. If you'd rather prefer to use a different API, you can find a list of public ones on this Github repo. The data that we're getting is really not that important for the purpose of this exercise.
-
SonarQube
Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
-
tesla
The flexible HTTP client library for Elixir, with support for middleware and multiple adapters.
To integrate the API via Elixir let's use the HTTP wrapper Tesla. There are many good options out there, such as the good old Httpoison. However, Tesla has some added benefits. I won't go into details as it's not the purpose of this article, but it's worth checking out.
-
We are going to be using the light http server Cowboy and the adapter Plug to return our data.
-
If you're not familiar with it, feel free to check the inner workings of Plug in their documentation. For now, the code above is fairly self-explanatory I hope. All we need to know is that we're using the Plug.Router capabilities and exposing an endpoint /bpi which we're going to use to retrieve our data and to show it.
-
PRO TIP: If you happen to have an existing Heroku account that you do not want to use for this exercise, you can use the [heroku-accounts](https://github.com/heroku/heroku-accounts) plugin to manage multiple accounts easily.
-
I've put a full working version of the code on this Github repository, in case you want to compare with it or simply clone it and test it.
-
Scout APM
Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.
-
Heroku has this idea of buildpacks, which transform your code into a slug that can be run on their platform and abstract all the complexity.
Related posts
- ElixirのHTTPクライアントでお天気情報を取得したい(2022年)
- Elixir: Consumindo dados de uma API externa
- how to make HTTPOISON POST request with form-data ?
- Combine Vite.js with Phoenix and Liveview to get instant updates during development
- What response type should I return from Axios if I want to return response in cases where it success or fails?