简体   繁体   中英

Erlang and Elixir/Phoenix in the same app

Has anyone used Erlang and Elixir in the same app? Would it be better to keep two separate repos - one for Erlang app and one for Phoenix/Elixir app?

Or can one combine Erlang/Elixir in the same app structure - as two different apps?

Thanks

I've used Erlang apps inside Elixir. For example, when I need a rich name register, I often use :gproc which is an Erlang app. In my mix.exs file I just add it to my applications:

defmodule MyApp.Mixfile do
  use Mix.Project

  (...)

  def application do
    [applications: [:logger, :gproc],
     mod: {MyApp, []}]
  end

  defp deps do
    [{:gproc, "~> 0.5.0"}]
  end
end

I personally would keep the apps in separate repositories mainly because they have a different project structure, but you can use them together by adding them to the dependencies of your project just like I did with :gproc in the example.

I hope this answer your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM