Pratik Khadloya
Pratik Khadloya

Reputation: 12869

Elixir Phoenix micro applications

I have a Phoenix app. All it does is authentication and it has a photo gallery, where users can upload photos and mark them public/private. I want to convert this into a micro application so that i can reuse it in another project i have.

I found http://blog.plataformatec.com.br/2015/06/elixir-in-times-of-microservices/, but it does not give more details on how to actually set things up in dev and in prod.

Can anyone elaborate more? Steps and code examples will help.

Upvotes: 1

Views: 330

Answers (1)

CoderDennis
CoderDennis

Reputation: 13837

I haven't tried this, but I asked on the Elixir slack.io #Phoenix channel and got a response from Chris McCord (author of Phoenix Framework):

forward "/gallery", GalleryLib.Router

then the library abides by the plug contract and does its thing

So, you'd include your photo gallery (called GalleryLib above) as a library within your other Phoenix app. Then choose which route you want to be handled by that library (eg. /gallery) and forward requests to it.

Here's the documentation on forward http://hexdocs.pm/phoenix/Phoenix.Router.html#forward/4

Upvotes: 4

Related Questions