{"id":28693243,"url":"https://github.com/evangipson/minimal-api","last_synced_at":"2026-04-28T17:03:21.701Z","repository":{"id":293876878,"uuid":"983964298","full_name":"evangipson/minimal-api","owner":"evangipson","description":"A thread-safe minimal API that serves JSON written in rust","archived":false,"fork":false,"pushed_at":"2025-07-17T15:58:22.000Z","size":93,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T18:12:08.981Z","etag":null,"topics":["api","json","rust","threading"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evangipson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-05-15T07:27:34.000Z","updated_at":"2025-07-17T15:58:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd4e0caa-c7be-4560-9a9e-a1d2bb04c363","html_url":"https://github.com/evangipson/minimal-api","commit_stats":null,"previous_names":["evangipson/minimal-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evangipson/minimal-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evangipson%2Fminimal-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evangipson%2Fminimal-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evangipson%2Fminimal-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evangipson%2Fminimal-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evangipson","download_url":"https://codeload.github.com/evangipson/minimal-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evangipson%2Fminimal-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","json","rust","threading"],"created_at":"2025-06-14T08:11:41.491Z","updated_at":"2026-04-28T17:03:21.694Z","avatar_url":"https://github.com/evangipson.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal API\nA thread-safe minimal API written in rust that serves JSON for HTTP requests.\n\nMinimal API currently supports:\n- Thread-safe workers to listen for requests, and serve out responses\n- `GET`, `POST`, `PUT`, and `DELETE` HTTP requests\n- Query string keys, body content, and dynamic path segments as function parameters\n- [A series of more complex routes](src/routes/mock/) to represent more realistic, complex scenarios\n\n## Getting Started\n1. Download the repo\n1. Navigate to the repo root\n1. Run the server either by:\n    - `docker compose up` to launch the API in Docker\n    - `cargo run` to launch the API locally\n1. Use your browser to hit the API and get a JSON response from an endpoint\n    - Check the [server config file](.cargo/) of the environment you chose for the address\n    - By default, there are index (\"/\"), \"/name\", and \"/version\" endpoints\n\n## Examples\n### Basic `GET`\nThe following example sets up a `GET` endpoint for the index route (`/`) that returns \"Hello!\":\n```rust\nuse http_attributes::http_get;\n\n#[http_get(\"/\")]\npub fn say_hello() -\u003e String {\n    format!(\"Hello!\")\n}\n```\n\n### `GET` with query parameters\nThe following example sets up a `GET` endpoint for the `/who` path that returns a message with the value of the `name` query parameter:\n```rust\nuse http_attributes::http_get;\n\n#[http_get(\"/who\")]\npub fn say_hello(name: String) -\u003e String {\n    format!(\"Hello, {name}!\")\n}\n```\n\n### `GET` with dynamic path segments\nThe following example sets up a `GET` endpoint for the `/user` path that returns a message with the value of the `id` path segment:\n```rust\nuse http_attributes::http_get;\n\n#[http_get(\"/user/{id}\")]\npub fn get_user(id: String) -\u003e String {\n    format!(\"Found user by id '{id}'!\")\n}\n```\n\n### Basic `POST`\nThe following example sets up a `POST` endpoint for the `/submit` path that returns the `POST` data:\n```rust\nuse http_attributes::http_post;\n\n#[http_post(\"/submit\")]\npub fn get_post_data(content: String) -\u003e String {\n    format!(\"Received '{content}' from POST\")\n}\n```\n\n### Basic `PUT`\nThe following example sets up a `PUT` endpoint for the `/update` path that returns the `PUT` data:\n```rust\nuse http_attributes::http_put;\n\n#[http_put(\"/update\")]\npub fn get_put_data(content: String) -\u003e String {\n    format!(\"Received '{content}' from PUT\")\n}\n```\n\n### Basic `DELETE`\nThe following example sets up a `DELETE` endpoint for the `/remove` path that returns a query parameter value sent to the `DELETE` route:\n```rust\nuse http_attributes::http_delete;\n\n#[http_delete(\"/remove\")]\npub fn get_delete_id(id: String) -\u003e String {\n    format!(\"Received '{id}' from DELETE\")\n}\n```\n\n## Creating Endpoints\n1. Create a file in the [routes definition folder](./src/routes)\n1. Write a function that returns a `String`\n1. Add any [HTTP macro attribute](libs/attributes/src/lib.rs) to the function\n1. Optionally, add any parameters to represent query strings or body data\n1. Add the function to the vector returned by [`get_endpoints()` in the routes definition file](./src/routes/index.rs), without providing any parameters if they were added\n1. The [server listen() function](./src/server/listener.rs) will automatically pick up the new endpoint\n\n## Environment Configuration\n- Modify the [`./cargo/config.toml`](.cargo/config.toml) file to change the ip address or port for local development.\n- Modify the [`./cargo/config.docker.toml`](.cargo/config.docker.toml) and [`./compose.yml`](compose.yml) files to change the ip address or port for docker development.\n\n## TODO:\n- [ ] Guard query string parameter (and body content) input casting with some sort of validation in the attributes library","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevangipson%2Fminimal-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevangipson%2Fminimal-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevangipson%2Fminimal-api/lists"}