{"id":16444896,"url":"https://github.com/jaymon/endpoints","last_synced_at":"2025-09-12T18:08:44.855Z","repository":{"id":57426424,"uuid":"10925264","full_name":"Jaymon/endpoints","owner":"Jaymon","description":"Lightweight REST api backend framework that automatically maps urls to python modules and classes","archived":false,"fork":false,"pushed_at":"2025-09-12T00:23:27.000Z","size":1856,"stargazers_count":29,"open_issues_count":16,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-12T00:26:03.592Z","etag":null,"topics":["api-server","python","rest","rest-api","web-framework","wsgi-server"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Jaymon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-06-25T01:42:53.000Z","updated_at":"2025-09-12T00:23:30.000Z","dependencies_parsed_at":"2022-09-11T04:22:25.765Z","dependency_job_id":"aedfdbd0-e8a9-47a3-b6a0-52efc538d62a","html_url":"https://github.com/Jaymon/endpoints","commit_stats":{"total_commits":324,"total_committers":6,"mean_commits":54.0,"dds":"0.058641975308642014","last_synced_commit":"f3864d4a8e915686fdefac34142a40245fdf2f35"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jaymon/endpoints","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fendpoints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fendpoints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fendpoints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fendpoints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaymon","download_url":"https://codeload.github.com/Jaymon/endpoints/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fendpoints/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274851192,"owners_count":25361533,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-server","python","rest","rest-api","web-framework","wsgi-server"],"created_at":"2024-10-11T09:42:31.807Z","updated_at":"2025-09-12T18:08:44.840Z","avatar_url":"https://github.com/Jaymon.png","language":"Python","readme":"# Endpoints\n\n_Endpoints_ is a lightweight REST api framework written in python that supports both WSGI and ASGI. _Endpoints_ has been used in multiple production systems that handle millions of requests daily.\n\n\n## Getting Started\n\n### Installation\n\nFirst, install endpoints with the following command.\n\n    $ pip install endpoints\n\nIf you want the latest and greatest you can also install from source:\n\n    $ pip install -U \"git+https://github.com/jaymon/endpoints#egg=endpoints\"\n\n\n### Create a Controller Module\n\nCreate a controller file with the following command:\n\n    $ touch controllers.py\n\nAdd the following code to the `controllers.py` file:\n\n```python\nfrom endpoints import Controller\n\nclass Default(Controller):\n  \"\"\"The special class `Default` handles / requests\"\"\"\n  async def GET(self):\n    return \"Default handler\"\n\n  async def POST(self, **kwargs):\n    return 'hello {}'.format(kwargs['name'])\n\nclass Foo(Controller):\n  \"\"\"This class handles `/foo` requests\"\"\"\n  async def GET(self):\n    return \"Foo handler\"\n```\n\n\n### Start a WSGI Server\n\nNow that you have your `controllers.py`, let's use the built-in WSGI server to serve them, we'll set our `controllers.py` file as the [controller prefix](docs/PREFIXES.md) so Endpoints will know where to find the [Controller classes](docs/CONTROLLERS.md) we just defined:\n\n    $ endpoints --prefix=controllers --host=localhost:8000\n\n\n### Start an ASGI Server\n\nInstall [Daphne](https://github.com/django/daphne):\n\n    $ pip install -U daphne\n\nAnd start it:\n\n    $ ENDPOINTS_PREFIX=controllers daphne -b localhost -p 8000 -v 3 endpoints.interface.asgi:Application.factory\n\n\n### Test it out\n\nUsing curl:\n\n    $ curl http://localhost:8000\n    \"Default handler\"\n    $ curl http://localhost:8000/foo\n    \"Foo handler\"\n    $ curl http://localhost:8000/ -d \"name=Awesome you\"\n    \"hello Awesome you\"\n\nThat's it!\n\nIn the ***first request*** (`/`), the `controllers` module was accessed, then the `Default` class, and then the `GET` method.\n\nIn the ***second request*** (`/foo`), the `controllers` module was accessed, then the `Foo` class as specified in the path of the url, and then the `GET` method.\n\nFinally, in the ***last request***, the `controllers` module was accessed, then the `Default` class, and finally the `POST` method with the passed in argument.\n\n\n## How does it work?\n\n*Endpoints* translates requests to python modules without any configuration.\n\nIt uses the following convention.\n\n    \u003cHTTP-METHOD\u003e /\u003cMODULE-PATH\u003e/\u003cCLASS-PATH\u003e/\u003cPOSITIONAL-ARGUMENTS\u003e?\u003cKEYWORD-ARGUMENTS\u003e\n\n_Endpoints_ will use the prefix module path you set as a reference point (either passed in via the environment variable `ENDPOINTS_PREFIX` or passed into the `Application(controller_prefix=...)` instance) to find the correct submodule using the path specified by the request.\n\nRequests are translated from the left bit to the right bit of the path.\nSo for the path `/foo/bar/che/baz`, endpoints would first check for the `\u003cPREFIX\u003e.foo` module, then the `\u003cPREFIX\u003e.foo.bar` module, then the `\u003cPREFIX\u003e.foo.bar.che` module, etc. until it fails to find a valid module.\n\nOnce the module is found, endpoints will then attempt to find the class with the remaining path parts. If no matching class is found then a class named `Default` will be used if it exists.\n\nOnce if finds the class, it will use the `\u003cHTTP-METHOD\u003e` (eg, `GET`) to decide what method on the found class to call.\n\nThis makes it easy to bundle your controllers into a `controllers` package/module.\n\n\n## Learn more about Endpoints\n\nThe [docs](https://github.com/jaymon/endpoints/tree/master/docs) contain more information about how _Endpoints_ works and what can be done with it.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fendpoints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaymon%2Fendpoints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fendpoints/lists"}