I want to match requests as /friend_request/something ; /friend_request/somethingElse in the same module. I have the following code
defmodule Server do
def start() do
dispatch_config = build_dispatch_config()
{ :ok, _ } = :cowboy.start_clear(:my_http_listener,
[{:port, 8080}],
%{ env: %{dispatch: dispatch_config}}
)
end
def build_dispatch_config do
:cowboy_router.compile([
{ :_,
[
{"/register", Elixir.Register, []},
{"/login", Elixir.Login, []},
{"/friend_request/:page", Elixir.Friend_Request, []},
{"/send_message", Elixir.Send_Message, []},
{"/home", Elixir.Home, []}
]}
])
end
end
The problem is that all requests like /friend_requests/something doesn't go to my Friend_Request module, even thought the documentation says otherwise. For all requests I get 404 not found http request.
How can I send such requests to the same module ?