To create a new API-only Phoenix project, you can use the phx.new generator with the --no-html and --no-assets flags.
mix phx.new my_api --no-html --no-assetsmix deps.getmix phx.gen.json Accounts User users name:string email:string password:string###For Handling JWT Add This in Mix.exs
defp deps do
[
{:joken, "~> 2.0"},
{:bcrypt_elixir, "~> 2.0"},
]
endTo start your Phoenix server:
- Run
mix setupto install and setup dependencies - Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Now you can visit localhost:4000 from your browser.
Ready to run in production? Please check our deployment guides.
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix