All Projects → mehcode → Shio Rs

mehcode / Shio Rs

Licence: other
Shio is a fast, simple, and asynchronous micro web-framework for Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Shio Rs

Uadmin
The web framework for Golang
Stars: ✭ 127 (-53.99%)
Mutual labels:  framework, web-framework
Flamingo Commerce
Flexible E-Commerce Framework on top of Flamingo. Used to build E-Commerce "Portals" and connect it with the help of individual Adapters to other services.
Stars: ✭ 151 (-45.29%)
Mutual labels:  framework, web-framework
Trails
🌲 Modern Web Application Framework for Node.js.
Stars: ✭ 1,688 (+511.59%)
Mutual labels:  framework, web-framework
Valval
The fastest web framework in V language (vlang)
Stars: ✭ 103 (-62.68%)
Mutual labels:  framework, web-framework
Amber
A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
Stars: ✭ 2,345 (+749.64%)
Mutual labels:  framework, web-framework
Core
🚀 The Node.js Framework highly focused on developer ergonomics, stability and confidence
Stars: ✭ 11,697 (+4138.04%)
Mutual labels:  framework, web-framework
Chicagoboss
Erlang web MVC, now featuring Comet
Stars: ✭ 1,825 (+561.23%)
Mutual labels:  framework, web-framework
Framework
IONDV. Framework is a high level framework for enterprise web applications development.
Stars: ✭ 54 (-80.43%)
Mutual labels:  framework, web-framework
Rocket
A web framework for Rust.
Stars: ✭ 15,760 (+5610.14%)
Mutual labels:  framework, web-framework
Ego
Ego is a full-stack web framework written in Go, lightweight and efficient front-end component solutions, based on gin. The front-end is compiled, does not affect the back-end.
Stars: ✭ 185 (-32.97%)
Mutual labels:  framework, web-framework
Toruk
Go web 开发脚手架
Stars: ✭ 78 (-71.74%)
Mutual labels:  framework, web-framework
Sanic
Async Python 3.7+ web server/framework | Build fast. Run fast.
Stars: ✭ 15,660 (+5573.91%)
Mutual labels:  framework, web-framework
Foal
Elegant and all-inclusive Node.Js web framework based on TypeScript. 🚀.
Stars: ✭ 1,176 (+326.09%)
Mutual labels:  framework, web-framework
Denovel
A Deno Framework For Web Artisan - Inspired by Laravel
Stars: ✭ 128 (-53.62%)
Mutual labels:  framework, web-framework
Cuba
CUBA Platform is a high level framework for enterprise applications development
Stars: ✭ 1,114 (+303.62%)
Mutual labels:  framework, web-framework
Siris
DEPRECATED: The community driven fork of Iris. The fastest web framework for Golang!
Stars: ✭ 146 (-47.1%)
Mutual labels:  framework, web-framework
Goyave
🍐 Elegant Golang REST API Framework
Stars: ✭ 811 (+193.84%)
Mutual labels:  framework, web-framework
Aurelia
Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.
Stars: ✭ 995 (+260.51%)
Mutual labels:  framework, web-framework
Playframework
Play Framework
Stars: ✭ 12,041 (+4262.68%)
Mutual labels:  framework, web-framework
Flamingo
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Stars: ✭ 198 (-28.26%)
Mutual labels:  framework, web-framework

Shio

Rust Build Status Coverage Status Crates.io Crates.io Docs.rs IRC

Shio is a fast, simple, and asynchronous micro web-framework for Rust.

  • 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.

  • Multithreaded. By default, requests are handled by multiple threads, each running an event loop powered by tokio.

  • Stability. Shio is fully committed to working and continuing to work on stable Rust.

Usage

[dependencies]
shio = "0.2.0"
extern crate shio;

use shio::prelude::*;

fn hello_world(_: Context) -> Response {
    Response::with("Hello World!\n")
}

fn hello(ctx: Context) -> Response {
    Response::with(format!("Hello, {}!\n", &ctx.get::<Parameters>()["name"]))
}

fn main() {
    Shio::default()
        .route((Method::GET, "/", hello_world))
        .route((Method::GET, "/{name}", hello))
        .run(":7878").unwrap();
}

Examples

Stateful

A request handler is a value that implements the shio::Handler trait.

Handlers are not cloned on each request and therefore may contain state. Note that any fields must be Send + Sync.

extern crate shio;

use std::thread;
use std::sync::atomic::{AtomicUsize, Ordering};
use shio::prelude::*;

#[derive(Default)]
struct HandlerWithState {
    counter: AtomicUsize,
}

impl shio::Handler for HandlerWithState {
    type Result = Response;

    fn call(&self, _: Context) -> Self::Result {
        let counter = self.counter.fetch_add(1, Ordering::Relaxed);

        Response::with(format!(
            "Hi, #{} (from thread: {:?})\n",
            counter,
            thread::current().id()
        ))
    }
}

Even More Examples

Many more usage examples/ are included with Shio.

Examples may be ran with cargo run -p <example name>. For instance, to run the hello example, use:

$ cargo run -p hello

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].