Building an Ad-hoc HTTP Server
Explore how to create an ad-hoc HTTP server in Elixir using Plug and Cowboy to mimic a weather API. Learn to configure endpoints, integrate with test environments, and write tests that accurately simulate external dependencies for reliable integration and end-to-end testing.
We'll cover the following...
We'll cover the following...
Let’s go back to the weather API use case.
The weather API exposes a GET /data/2.5/forecast endpoint that we hit from our application. This endpoint accepts two parameters in the query string:
- Parameter
qrepresents the query. APPID, which identifies the credentials of our application.
The endpoint returns a 200 OK HTTP response with a JSON body containing information about the ...