{"id":22161957,"url":"https://github.com/codedge-llc/mapi","last_synced_at":"2025-07-26T09:32:16.762Z","repository":{"id":57520649,"uuid":"106127142","full_name":"codedge-llc/mapi","owner":"codedge-llc","description":"Turn your Elixir module into an HTTP microservice API","archived":false,"fork":false,"pushed_at":"2018-04-25T16:00:19.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-17T17:49:27.948Z","etag":null,"topics":["elixir"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codedge-llc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-10-07T20:08:18.000Z","updated_at":"2024-08-31T06:28:36.000Z","dependencies_parsed_at":"2022-09-26T18:01:02.716Z","dependency_job_id":null,"html_url":"https://github.com/codedge-llc/mapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fmapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fmapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fmapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fmapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codedge-llc","download_url":"https://codeload.github.com/codedge-llc/mapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227668673,"owners_count":17801517,"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":["elixir"],"created_at":"2024-12-02T04:17:42.497Z","updated_at":"2024-12-02T04:17:43.193Z","avatar_url":"https://github.com/codedge-llc.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/codedge-llc/mapi.svg?branch=master)](https://travis-ci.org/codedge-llc/mapi)\n[![Coverage Status](https://coveralls.io/repos/github/codedge-llc/mapi/badge.svg)](https://coveralls.io/github/codedge-llc/mapi)\n[![Hex.pm](http://img.shields.io/hexpm/v/mapi.svg)](https://hex.pm/packages/mapi)\n\n# mapi\nTurn your Elixir module into an HTTP microservice API\n\nSupports HTTP/1.1 and HTTP/2. Very much a work in progress.\n\n## Installation\n\n1. Add `mapi` to your list of dependencies in `mix.exs`:\n\n  ```elixir\n  def deps do\n    [\n      {:mapi, \"~\u003e 0.3.0\"}\n    ]\n  end\n  ```\n\n2. Configure your endpoints in `config.exs`\n\n  ```elixir\n  config :mapi, endpoints: [\n    {YourModule, [port: 4002]}\n  ]\n  ```\n\n## Usage\n\nSet up an example server for the `String` module with JSON responses.\n\n  ```elixir\n  # config.exs\n  config :mapi, endpoints: [\n    {String, [port: 4002, type: :json]}\n  ]\n  ```\n\nOnce configured, call your server as if you were calling the function.\nMapi supports both HTTP/1.1 and HTTP/2.\n\n  ```bash\n  $ curl localhost:4002/upcase?q1=\"testing\"\n  \"TESTING\"\n  ```\n\nURL params are applied to the function in alphabetical order without respect\nto the parameter names themselves. Use parameter names such as `q1, q2, ...`.\nParameters are strings, but will be cast to integers, atoms, and booleans if\napplicable. All other types are not yet supported.\n\nCurrently only `GET` requests are supported.\n\n## Responses\n\nMapi currently supports the following response types:\n\n  * Plaintext\n  * JSON\n  * Erlang ETF\n\nConfigure them with a `:type` option of either `:text`, `:json`, or `:etf`,\nrespectively. If not specified, Mapi will default to plaintext.\n\nAll valid requests give a response of `200` status. Invalid paths will\nreturn `404`. Valid paths with an incorrect number of parameters will return\n`400`, and all other errors will return `500`.\n\n## Roadmap TODO\n\n* Configurable support for HTTP methods other than `GET`\n* Body parameter decoding (for non-GET requests)\n* Configurable endpoint webserver\n* Support for nested paths, custom routing, etc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fmapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodedge-llc%2Fmapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fmapi/lists"}