Example Elixir with, Phoenix Framework, Ecto ORM, PostgreSQL, GraphQL, Resful, Auth SSO with JWT and much more.
MIX_ENV=dev mix phx.serverOn your bashrc or .zshrc put this: export MIX_ENV=dev
| Endpoint | Method | Action |
|---|---|---|
| /graphql | POST | |
| /graphiql | GET | |
| /users | GET | Index |
| /users | POST | Store |
| /users | PATCH | Update |
| /users/:id | DELETE | Destroy |
| /users/:id | GET | Show |
If you use Insomnia, just import a insomnia-v4.yaml
├── _build
├── assets
├── config
├── deps
├── lib
│ └── exampleElixir
│ └── exampleElixir.ex
│ └── exampleElixir_web
│ └── exampleElixir_web.ex
├── priv
└── test
lib/exampleElixir_web
├── channels
│ └── user_socket.ex
├── controllers
│ └── page_controller.ex
├── templates
│ ├── layout
│ │ └── app.html.eex
│ └── page
│ └── index.html.eex
├── views
│ ├── error_helpers.ex
│ ├── error_view.ex
│ ├── layout_view.ex
│ └── page_view.ex
├── endpoint.ex
├── gettext.ex
├── router.ex
└── telemetry.ex
mix phx.gen.schema User users name:string email:string \
bio:string number_of_pets:integerTo start your Phoenix server:
- Install dependencies with
mix deps.get - Create and migrate your database with
mix ecto.setup - Install Node.js dependencies with
npm installinside theassetsdirectory - Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000 from your browser.
Ready to run in production? Please check our deployment guides.
We are almost there! The following steps are missing:
$ cd exampleElixir
Then configure your database in config/dev.exs and run:
$ mix ecto.create
Start your Phoenix app with:
$ mix phx.server
You can also run your app inside IEx (Interactive Elixir) as:
$ iex -S mix phx.server
- 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