Phoenix Project

If you don't have an existing project, create one. This guide is tailored for backend API projects (no static assets). If you are serving HTML and assets, you will need to modify some of the server configs and build commands in later chapters.

Run the following to generate a skeleton project (replace "example" with your project name).

mix phoenix.new example --no-brunch --no-html
cd example
mix ecto.create

Next, configure Phoenix to run in the production environment you'll create.

Replace your prod config with the following (replace "example" with your project name—you can edit here and then copy/paste).

example/config/prod.exs

use Mix.Config config :example, Example.Endpoint http: [port: 4000], cache_static_lookup: false, check_origin: false config :logger, level: :info config :phoenix, :serve_endpoints, true import_config "prod.secret.exs"

Right arrow!

results matching ""

    No results matching ""