{"id":13508207,"url":"https://github.com/AgilionApps/relax","last_synced_at":"2025-03-30T10:30:44.429Z","repository":{"id":23909382,"uuid":"27289492","full_name":"AgilionApps/relax","owner":"AgilionApps","description":"Simple Elixir implementation of a jsonapi.org server.","archived":false,"fork":false,"pushed_at":"2016-05-14T13:59:14.000Z","size":99,"stargazers_count":123,"open_issues_count":0,"forks_count":13,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-05-02T09:16:00.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgilionApps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-29T02:57:41.000Z","updated_at":"2024-03-09T18:57:30.000Z","dependencies_parsed_at":"2022-08-22T06:50:55.019Z","dependency_job_id":null,"html_url":"https://github.com/AgilionApps/relax","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgilionApps%2Frelax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgilionApps%2Frelax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgilionApps%2Frelax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgilionApps%2Frelax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgilionApps","download_url":"https://codeload.github.com/AgilionApps/relax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246307577,"owners_count":20756473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:49.749Z","updated_at":"2025-03-30T10:30:44.124Z","avatar_url":"https://github.com/AgilionApps.png","language":"Elixir","funding_links":[],"categories":["Frameworks"],"sub_categories":[],"readme":"# Relax\n\n**A Plug based toolset for building simple [jsonapi.org](http://jsonapi.org)\nspec APIS.**\n\nRelax is still in an early state of development (pre 1.0), so please check the\nchangelog before updating.\n\nRelax APIs are composed of a Router and Resources for handling requests, and\ncomplimented by [JaSerializer](http://github.com/AgilionApps/ja_serializer) for\nformatting responses.\n\n## Example\n\nThis example exposes the following endpoints:\n\n* GET    /v1/posts/\n* GET    /v1/posts/?filter[title]=elixir\n* GET    /v1/posts/:id\n* POST   /v1/posts\n* PUT    /v1/posts/:id\n* DELETE /v1/posts/:id\n\n```elixir\ndefmodule MyApp do\n  defmodule Router do\n    use Relax.Router\n\n    plug :router\n    plug :not_found\n\n    version :v1 do\n      resource :posts, MyApp.API.Posts\n    end\n  end\n\n  defmodule API.Posts do\n    use Relax.Resource\n\n    def serializer, do: MyApp.Serializer.Post\n    def error_serializer, do: JaSerializer.EctoErrorSerializer\n    def model, do: MyApp.Models.Post\n\n    plug :resource\n    plug :not_found\n\n    def fetchable(conn) do\n      Ecto.Model.assoc(conn.assigns[:current_user], :posts)\n    end\n\n    def filter(\"title\", queryable, value) do\n      Ecto.Query.where(queryable, [p], ilike(a.title, ^\"%#{value}%\"))\n    end\n\n    def create(_conn, attributes) do\n      MyApp.Models.Post.changeset(:create, attributes)\n    end\n\n    def update(_conn, post, attributes) do\n      MyApp.Models.Post.changeset(:create, post, attributes)\n    end\n\n    def delete(_conn, post) do\n      MyApp.Repo.delete!(post)\n    end\n\n    def permitted_attributes(_model, _conn), do: [:title, :body]\n    def permitted_relations(_model, _conn), do: []\n  end\n\n  defmodule Serializer.Post do\n    use JaSerializer\n\n    serialize \"posts\" do\n      attributes [:id, :title, :body]\n    end\n  end\nend\n```\n\n## Installation\n\nRelax is Alpha software and APIs are still stabalizing, use at your own risk.\n\n```elixir\n{:relax, \"~\u003e 0.2.2\"}\n```\n\n## Usage/Documentation\n\nSee [http://hexdocs.pm/relax](http://hexdocs.pm/relax) for detailed usage and\ndocumentation.\n\n## jsonapi.org Spec Compliance\n\nPlease see [JaSerializer](http://github.com/AgilionApps/ja_serializer) for\ndata serialization compliance.\n\n- [x] Content Negotiation\n  - [x] [Send content type](http://jsonapi.org/format/#content-negotiation)\n  - [x] [Reject media type](http://jsonapi.org/format/#content-negotiation)\n- [x] Document Structure - see [JaSerializer](http://github.com/AgilionApps/ja_serializer)\n- [ ] Fetching Data\n  - [x] [Fetching Resources](http://jsonapi.org/format/#fetching-resources)\n  - [x] [Filtering](http://jsonapi.org/format/#fetching-filtering)\n  - [ ] [Fetching Relationships](http://jsonapi.org/format/#fetching-relationships)\n  - [ ] [Fetching Includes](http://jsonapi.org/format/#fetching-includes) (includes query param not supported)\n  - [ ] [Sparse Fieldsets](http://jsonapi.org/format/#fetching-sparse-fieldsets)\n  - [x] [Sorting](http://jsonapi.org/format/#fetching-sorting)\n  - [ ] [Pagination](http://jsonapi.org/format/#fetching-pagination)\n- [ ] CRUD\n  - [x] [Creating Resources](http://jsonapi.org/format/#crud-creating)\n  - [x] [Updating Resources](http://jsonapi.org/format/#crud-updating)\n  - [x] [Deleting Resources](http://jsonapi.org/format/#crud-deleting)\n  - [ ] [Updating Relationships](http://jsonapi.org/format/#crud-updating-relationships)\n- [ ] [Errors](http://jsonapi.org/format/#errors)\n- [ ] Query Params - [Not currently enforced](http://jsonapi.org/format/#query-parameters)\n\n## License\n\nRelax source code is released under Apache 2 License. Check LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAgilionApps%2Frelax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAgilionApps%2Frelax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAgilionApps%2Frelax/lists"}