{"id":13683582,"url":"https://github.com/mehcode/shio-rs","last_synced_at":"2025-04-05T04:11:42.517Z","repository":{"id":57667242,"uuid":"100137055","full_name":"mehcode/shio-rs","owner":"mehcode","description":"Shio is a fast, simple, and asynchronous micro web-framework for Rust.","archived":false,"fork":false,"pushed_at":"2018-02-16T20:43:25.000Z","size":221,"stargazers_count":278,"open_issues_count":18,"forks_count":13,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-18T06:38:57.809Z","etag":null,"topics":["framework","rust","web","web-framework"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mehcode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-12T20:47:57.000Z","updated_at":"2024-02-13T15:42:44.000Z","dependencies_parsed_at":"2022-09-02T14:11:08.142Z","dependency_job_id":null,"html_url":"https://github.com/mehcode/shio-rs","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehcode%2Fshio-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehcode%2Fshio-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehcode%2Fshio-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehcode%2Fshio-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mehcode","download_url":"https://codeload.github.com/mehcode/shio-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284950,"owners_count":20913704,"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":["framework","rust","web","web-framework"],"created_at":"2024-08-02T13:02:16.408Z","updated_at":"2025-04-05T04:11:42.495Z","avatar_url":"https://github.com/mehcode.png","language":"Rust","readme":"# Shio\n![Rust](https://img.shields.io/badge/rust-stable-brightgreen.svg)\n[![Build Status](https://travis-ci.org/mehcode/shio-rs.svg?branch=master)](https://travis-ci.org/mehcode/shio-rs)\n[![Coverage Status](https://coveralls.io/repos/github/mehcode/shio-rs/badge.svg?branch=master)](https://coveralls.io/github/mehcode/shio-rs?branch=master)\n[![Crates.io](https://img.shields.io/crates/v/shio.svg)](https://crates.io/crates/shio)\n[![Crates.io](https://img.shields.io/crates/d/shio.svg)](https://crates.io/crates/shio)\n[![Docs.rs](https://docs.rs/shio/badge.svg)](https://docs.rs/shio)\n[![IRC](https://img.shields.io/badge/chat-%23shio-yellow.svg)](https://kiwiirc.com/client/irc.mozilla.org/#shio)\n\u003e Shio is a fast, simple, and asynchronous micro web-framework for Rust.\n\n - **Asynchronous**. Handlers are both handled _asynchronously_ and may be _asynchronous_ themselves. A `shio::Handler` receives a `tokio_core::reactor::Handle` which may be used to schedule additional work on the thread-local event loop.\n\n - **Multithreaded**. By default, requests are handled by multiple threads, each running an event loop powered by `tokio`.\n\n - **Stability**. Shio is fully committed to working and continuing to work on **stable** Rust.\n\n## Usage\n\n```toml\n[dependencies]\nshio = \"0.2.0\"\n```\n\n```rust\nextern crate shio;\n\nuse shio::prelude::*;\n\nfn hello_world(_: Context) -\u003e Response {\n    Response::with(\"Hello World!\\n\")\n}\n\nfn hello(ctx: Context) -\u003e Response {\n    Response::with(format!(\"Hello, {}!\\n\", \u0026ctx.get::\u003cParameters\u003e()[\"name\"]))\n}\n\nfn main() {\n    Shio::default()\n        .route((Method::GET, \"/\", hello_world))\n        .route((Method::GET, \"/{name}\", hello))\n        .run(\":7878\").unwrap();\n}\n```\n\n## Examples\n\n### [Stateful](examples/stateful/src/main.rs)\n\nA request handler is a value that implements the `shio::Handler` trait.\n\nHandlers are **not** cloned on each request and therefore may contain state.\nNote that any fields must be `Send + Sync`.\n\n```rust\nextern crate shio;\n\nuse std::thread;\nuse std::sync::atomic::{AtomicUsize, Ordering};\nuse shio::prelude::*;\n\n#[derive(Default)]\nstruct HandlerWithState {\n    counter: AtomicUsize,\n}\n\nimpl shio::Handler for HandlerWithState {\n    type Result = Response;\n\n    fn call(\u0026self, _: Context) -\u003e Self::Result {\n        let counter = self.counter.fetch_add(1, Ordering::Relaxed);\n\n        Response::with(format!(\n            \"Hi, #{} (from thread: {:?})\\n\",\n            counter,\n            thread::current().id()\n        ))\n    }\n}\n```\n\n### Even More Examples\n\nMany more usage [examples/](https://github.com/mehcode/shio-rs/tree/master/examples) are included with Shio.\n\n  - [Render templates](examples/templates_askama/src/main.rs) with [Askama](https://github.com/djc/askama)\n  - [Stream a HTTP request](examples/proxy/src/main.rs) with [Hyper](https://github.com/hyperium/hyper)\n  - [Postgres](examples/postgres/src/main.rs) with [tokio-postgres](https://github.com/sfackler/rust-postgres)\n\nExamples may be ran with `cargo run -p \u003cexample name\u003e`.\nFor instance, to run the `hello` example, use:\n\n```bash\n$ cargo run -p hello\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehcode%2Fshio-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehcode%2Fshio-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehcode%2Fshio-rs/lists"}