Elixir Phoenix 微应用

Elixir Phoenix micro applications

我有一个 Phoenix 应用程序。它所做的只是身份验证,它有一个照片库,用户可以在其中上传照片并进行标记 public/private。我想将它转换成一个微型应用程序,以便我可以在我的另一个项目中重用它。

我找到了 http://blog.plataformatec.com.br/2015/06/elixir-in-times-of-microservices/,但它没有提供更多关于如何在开发和生产环境中进行实际设置的详细信息。

谁能详细说说?步骤和代码示例会有所帮助。

我没试过这个,但我在 Elixir slack.io #Phoenix 频道上询问并得到了 Chris McCord(Phoenix Framework 的作者)的回复:

forward "/gallery", GalleryLib.Router

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

因此,您可以将您的照片库(在上面称为 GalleryLib)作为您的其他 Phoenix 应用程序中的一个库。然后选择您希望该库处理的路由(例如 /gallery)并将请求转发给它。

这是关于 forward http://hexdocs.pm/phoenix/Phoenix.Router.html#forward/4

的文档