How to add support for a new HTTP request method in phoenix routes

I need to add PURGE methood in phoenix routes. We use cache in nginx and to delete cache we use PURGE method which I can’t implement

In my opinion you should try to avoid to assume that others know what you are referring to. This PURGE method is not even a standard HTTP method:

But I can see that Nginx seems to have “invented” it :slight_smile:

You can use Phoenix.Router.match/5: Phoenix.Router — Phoenix v1.5.8

2 Likes

You can use match:

https://hexdocs.pm/phoenix/Phoenix.Router.html#match/5

You may want to create a custom plug to use the match :

https://hexdocs.pm/phoenix/plug.html

Oh, it seems that you posted while I was writing mine. Sorry for the overlap :slight_smile:

1 Like

Thanks.

1 Like