# Craweb
Multithreaded asynchronous web server, written in Rust. And it's really fast (we are handling one request in less than 1 second)! ### Installation You can install this crate using [crates.io](https://crates.io/crates/craweb). ```toml [dependencies] craweb = "*" # Or you can replace version with specific ones. ``` ### Writing basic server In order to start the server, you must do the following: 1. Initialize the server in your `main.rs` file. 2. Add at least one route. 3. Bind the server to the specific IP address and port. Here's an example (as well as in the [example_server](https://gitlab.com/Pelfox/craweb/-/tree/main/example_webserver) in the root repository): ```rust use std::collections::HashMap; use std::sync::Arc; use craweb::{ models::Response, server::Server, }; #[tokio::main] async fn main() { let mut server = Server::new(None, None, None); server.get("/", |_| { let mut headers = HashMap::new(); headers.insert("Content-Type", "application/json"); return Response { content: "{\"status\": \"Hello, World!\"}", status_code: 200, status_message: "OK", headers, }; }); Arc::new(server).bind("127.0.0.1:3000").await; } ``` ### License This crate is licensed under the MIT License. You can read the full license text [here](https://gitlab.com/Pelfox/craweb/-/blob/main/craweb/LICENSE).