# salvo
**Repository Path**: chrislearn/salvo
## Basic Information
- **Project Name**: salvo
- **Description**: No description available
- **Primary Language**: Rust
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-12-25
- **Last Updated**: 2021-01-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Salvo
[/badge.svg?branch=master&event=push)](https://github.com/kenorld/salvo/actions)
[/badge.svg?branch=master&event=push)](https://github.com/kenorld/salvo/actions)
[/badge.svg?branch=master&event=push)](https://github.com/kenorld/salvo/actions)
[](https://codecov.io/gh/kenorld/salvo)
[](https://crates.io/crates/salvo)
[](https://crates.io/crates/salvo)

Salvo is a simple web framework written by rust.
## Features
* Base on hyper, tokio.
* Tree-like routing system.
## Quick start
You can view samples [here](https://github.com/kenorld/salvo/tree/master/examples) or read docs [here](https://docs.rs/salvo/).
Create a new rust project:
```bash
cargo new hello_salvo --bin
```
Add this to `Cargo.toml`
```toml
[dependencies]
salvo = "0.4"
tokio = { version = "1.0", features = ["full"] }
```
Create a simple function handler in the main.rs file, we call it `hello_world`, this function just render plain text "Hello World".
```rust
use salvo::prelude::*;
#[fn_handler]
async fn hello_world(_req: &mut Request, _depot: &mut Depot, res: &mut Response) {
res.render_plain_text("Hello World");
}
```
In the main function, we need to create a root Router first, and then create a server and call it's serve function:
```rust
use salvo::prelude::*;
#[fn_handler]
async fn hello_world(res: &mut Response) {
res.render_plain_text("Hello World");
}
#[tokio::main]
async fn main() {
let router = Router::new().get(hello_world);
let server = Server::new(router);
server.bind(([0, 0, 0, 0], 7878)).await;
}
```
## License
Salvo is licensed under MIT License ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)