HFQR / xitca-web

An HTTP library and web framework for safe Rust
https://docs.rs/xitca-web/latest/xitca_web/
Apache License 2.0
766 stars 46 forks source link
http rust web-framework

Xitca-Web

Readme | GitHub | Documentation

GitHub code size in bytes Maintenance

A HTTP library and web framework written in 100% safe Rust with zero-copy serialization/deserilization support


Table of Contents

- [Features](#features) - [Minimum Supported Rust Version](#minimum-supported-rust-version) - [Quick Start](#quick-start) - [FAQ (Frequently Asked Questions)](#faq-frequently-asked-questions) - [More Contributors Wanted](#more-contributors-wanted) - [Supporting Xitca-web](#supporting-xitca-web) - [Documentation](#documentation) - [Roadmap](#roadmap) - [Contributing](#contributing) - [License](#license) - [Credits](#credits)

Features

⬆️ Back to Top

Minimum Supported Rust Version

The latest release of the crate supports 1.79 and above rust versions.

⬆️ Back to Top

Quick Start

For a list of other examples, see: Examples

To get started using Xitca-web add the following code to your main.rs file:

use xitca_web::{handler::handler_service, middleware::Logger, route::get, App};

async fn index() -> &'static str {
    "Hello world!!"
}

fn main() -> std::io::Result<()> {
    App::new()
        .at("/", get(handler_service(index)))
        .enclosed(Logger::new())
        .serve()
        .bind("localhost:8080")?
        .run()
        .wait()
}

And then add the following dependencies to your Cargo.toml file:

xitca-web = { version = "*" , features = ["logger"]}

And then run the application/server using cargo run command and it should start the server/application on http://127.0.0.1:8080. Open your prefered browser and navigate to the address on which the server has started and you should see a hello world!! message appear.

[!Warning] The project is still not stable. So expect breaking changes to appear at any time.

⬆️ Back to Top

FAQ (Frequently Asked Questions)

Why Yet Another HTTP Library and Framework?

The primary reason behind creating Xitca-web is to provide more memory safe framework which uses 100% safe rust. As well as to provide a framework which provides its own HTTP library, async IO abstraction, tls integration and a database driver all in one package with a low-memory footprint, less synchronization overhead between threads, a very small dependency tree and with good interoperability between with other async frameworks like tokio, async-std, etc and with crates like Tower and HTTP. Additionally, the following HTTP library and framework was built to provide a simple and compact code base with easier to understand and adoptable API both internally and externally and to provide the choice to the user to opt-out of macro usage when using xitca-web which can greatly improve build/compile times by eliminating the extra proc-macro build/compile step.

⬆️ Back to Top

More Contributors Wanted

We are looking for more willing contributors to help grow this project. For more information on how you can contribute, check out the project board and the CONTRIBUTING.md file for guidelines and rules for making contributions.

⬆️ Back to Top

Supporting Xitca-web

For full details and other ways you can help out, see: Contributing

If you use Xitca-web and would like to contribute to its development, we're glad to have you on board! Contributions of any size or type are always welcome, and we will always acknowledge your efforts.

Several areas that we need a bit of help with at the moment are:

⬆️ Back to Top

Documentation

[!Note] We welcome any contributions to the documentation as this will benefit everyone who uses this project.

⬆️ Back to Top

Roadmap

Coming soon!.

⬆️ Back to Top

Contributing

Contributions are welcome from anyone. It doesn't matter who you are; you can still contribute to the project in your own way.

Not a developer but still want to contribute?

Check out this video by Mr. Nick on how to contribute.

Developer

If you are a developer, have a look at the CONTRIBUTING.md document for more information.

⬆️ Back to Top

License

Xitca-web is licensed under the APACHEv2 license.

⬆️ Back to Top

Credits

We would like to thank the following people for their contributions and support:

Contributors



Stargazers

⬆️ Back to Top




Thank you for Visiting