ApiCommons (ApiCommons v0.1.0) View Source

Functions and Macros for quick REST API endpoint generation.

A full guide to REST API's can be found here

Link to this section Summary

Functions

Create a resource

Macro to create an rest api endpoint for resource creation.

Macro to delete a resource.

Generate an API Endpoint to request a list of ressources.

Macto to update a resource

Query entities returns the result

Call a specific render function for encoded data in conn

Use a predefined schema as a resource

Macro to create an rest api endpoint for resource display.

Link to this section Functions

Create a resource

Macro to create an rest api endpoint for resource creation.

Macro to delete a resource.

Generate an API Endpoint to request a list of ressources.

Parameter

  • schema (Ecto.Schema) The schema to be used for the endpoint generation
  • params (Map) Parameters to modify the output

Macto to update a resource

Query entities returns the result

Link to this macro

render(conn, template, params \\ %{})

View Source (macro)

Call a specific render function for encoded data in conn

Parameter

  • conn: Plug.Conn
  • template: String describe the template to render
  • params: The parameter to pass to the render function
Link to this function

resource(conn, ecto_schema, opts)

View Source

Use a predefined schema as a resource

Macro to create an rest api endpoint for resource display.