Skip to content

connorslade/afire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ afire Crates.io

afire is a blazingly fast web server micro framework for rust.

๐Ÿ’  Install

Just add the following to your Cargo.toml:

[dependencies]
afire = "2.2.1"

๐Ÿ“„ Info

afire is a simple synchronous multithreaded express.js inspired rust web micro framework. wow that was long. It comes with some built extensions in for Static File Serving, Rate limiting, and more.

Below you can find links to some afire related resources.

๐Ÿ’ฅ Example

For more examples see the examples directory here.

Below is a super simple example so you can see the basics of afire syntax.

// Import Lib
use afire::{Server, Method, Response, Header, Content};

// Create Server
let mut server = Server::<()>::new("localhost", 8080);

// Add a route
server.route(Method::GET, "/greet/{name}", |req| {
  let name = req.param("name").unwrap();

  Response::new()
    .text(format!("Hello, {}", name))
    .content(Content::TXT)
});

// Start the server
// This is blocking
server.start().unwrap();

๐Ÿ’ผ License

afire is licensed under the MIT license so you are free to do basically whatever you want with it as long as you add a copyright notice. You can read the full license text here.