micro_http_async

Crates.iomicro_http_async
lib.rsmicro_http_async
version0.1.4
sourcesrc
created_at2021-02-04 17:23:21.877089
updated_at2022-01-11 01:24:51.463624
descriptionA small, lightweight and hassle-free crate using async to serve web pages or web apis with high performance and extremely low overhead.
homepage
repositoryhttps://github.com/dimitribobkov/micro-http-async
max_upload_size
id350630
size64,977
Dimitri Bobkov-Rolandez (dimitri-br)

documentation

https://docs.rs/micro_http_async

README

micro_http_async

What is it for?

A small, lightweight crate using async to serve web pages or web apis with high performance and low overhead.

How do I use it?

Firstly, install the crate and dependencies:

[dependencies]
micro_http_async = "*"
tokio = "1.11.0"

And if you want to support JSON:

serde_json = "1.0"
serde = {version = "1.0", features = ["derive"]}

This crate is designed to abstract away many of the low level code required to run a safe, asynchronous web server Here is a small example which shows how to route, use asynchronous call backs and load webpage templates from HTML files. For the HTML files included, please go to the repository and check the templates folder. Static files also included. To run the included example (which is the example seen below), run cargo run --example hello_world, and visit 127.0.0.1:8080 Please note this is probably not the final API

Examples

This crate aims only to simplify web api or lightweight web creation - not intended to run full scale web apps like chatrooms or other high intensity applications. It implements a simple asynchronous routing system (Made using hash maps for speed and efficiency) as well as asynchronous file loading and more.

It also supports TLS if security is a requirement through the rustls and tokio-rustls crates.

Changelog v0.1.4: TLS support is now available. See the hello_world example for an example on usage.

Commit count: 40

cargo fmt