Multiple EndPoints?

My app will be serving multiple projects, so, I thought that each project will be served through a different port, here is my prod file:

config :trackware, MyApp.Endpoint,
http: [port: 4001],
cache_static_manifest: “priv/static/manifest.json”

config :trackware, MyApp.Schools.Endpoint,
http: [port: 4011],
cache_static_manifest: “priv/static/manifest.json”

where each endpoint uses a different socket module

like:

defmodule MyApp.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app

socket “/socket”, MyApp.UserSocket

And another endpoint:

defmodule MyApp.Schools.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app

socket “/socket”, MyApp.Schools.SchoolSocket

AM I on the right track?

2 Likes

Yes, you are. Each endpoint in that case starts it’s own Cowboy too, on different ports.

3 Likes