Getting Started

The easiest set up involves using Phoenix. It should be roughly the same to set up an application using only Plug.

Configure your resources and API

See AshJsonApi.Api and AshJsonApi.Resource for information on configuring your apis and resources.

Create a router

defmodule MyApp.MyApi.Router do
  # The registry must be explicitly provided here
  use AshJsonApi.Api.Router, api: Api, registry: Registry 

Accept json_api content type

Add the following to your config/config.exs

# config/config.exs
config :mime, :types, %{
  "application/vnd.api+json" => ["json"]

This configuration is required to support working with the JSON:API custom mime type.

Add the routes from your API module(s)

Forward requests to the from your Phoenix router to the router you created for your Api.

For example:

scope "/json_api" do

  forward "/helpdesk", MyApp.MyApi.Router

Run your API

From here on out its the standard phoenix behavior. Start your application with mix phx.server and your API should be ready to try out