Running the HTTP server with a sample application
In order to test the HTTP server package with a sample application, we can create a new application with the --sup
option so that we can start the HTTP server with the application. This can be done by running the following command in the root of the HTTP server package itself:
$ mix new test_goldcrest_http_server --sup
Next, we can add goldcrest_http_server
to mix dependencies using relative paths. This is a great way to test a package since you can be sure to always use the current version of the package while running your tests:
mix.exs
defmodule TestGoldcrestHTTPServer.MixProject do # .. defp deps do [ {:goldcrest_http_server, path: "../goldcrest_http_server"} ] end end
Next up is defining a Responder
. We can define a resp/3
function just as...