Js_client - a simple macro to crate a javascript client for Phoenix routes


I do not know if such promotion is allowed and hope it will be fine.

I’ve just published a small Elixir package now that I have to use this code in several projects.

It consists in a simple macro that select some routes of your Phoenix router from the pipeline they go through and outputs a javascript file that defines the routes on the client side.

The javascript code does not make XHR requests by itself and require you to code the HTTP layer, but the most simple way is just to give it axios as a callback and everything should work out of the box.

It works well, but lacks configuration or documentation. A full example is provided though.

I hope it can help some of you.

Thank you for reading.