Closed CrowdHailer closed 7 years ago
def init(app, config) do
end
def handle_request(request, {next, methods}) do
override_method(request, only: methods)
|> next.handle_request
end
not_found = Raxx.NotFound
router = {MyRouter, {not_found, config}}
server = {Raxx.MethodOverride, {router, methods}}
defmodule Server do
use Raxx.Stack
middleware Raxx.MethodOverride, [PUT, PATCH, DELETE]
middleware MyRouter, config
middleware
end
Ace.HTTP.start_link(server, port: port)
Can be done using make_overrideable
examples are available in Tokumei
I think there must be some great macro stuff possible here to reduce runtime lookups