Feather
Feather is a lightweight, flexible, and highly extensible web framework for Rust, inspired by the simplicity and modularity of Express.js.
Feather aim's to be simple and minimal alternative to other web frameworks such as Actix or Axum.
Features
- Middleware Support: Chain and compose middleware functions effortlessly.
- Route Handling: Support for multiple HTTP methods (
GET,POST,PUT,DELETE, etc.). - Lightweight: Built using Rust’s high-performance and memory-safe features.
- Thread-Safe: Leverages Rust's thread safe aspects.
Modules
middleware: Contains the middleware trait and related functionalityresponse: Defines the Response type used throughout the frameworksync: Contains the main application and configuration structs
Installation
To get started with Feather, add it as a dependency in your Cargo.toml:
[]
= "0.2.0"
Quick Start
Here's an example of building a simple web server with Feather:
// Import dependencies from Feather
use ;
use Logger;
use ;
// Main function - no async here!
Middleware
Feather supports middleware for pre-processing requests and post-processing responses, and you can make your own too! Here's an example:
// Import dependencies from Feather
use ;
// Import the Middleware trait and some common middleware primitives
use ;
// Implementors of the Middleware trait are middleware that can be used in a Feather app.
;
// The Middleware trait defines a single method `handle`,
// which can mutate the request and response objects, then return a `MiddlewareResult`.
Built-in middleware includes:
Logger: Logs incoming requests.Cors: Add cross-origin resource sharing headers to your response.ServeStatic: Serves Static Files in the given Directory
Goals
- Be the most simple & beginner-friendly web framework for Rust
- Be modular and expandable by design
- Be easy to use and learn
Contributing
Contributions are welcome! If you have ideas for improving Feather or find a bug, feel free to open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/my-feature. - Commit your changes:
git commit -m 'Add my feature'. - Push to the branch:
git push origin feature/my-feature. - Open a pull request.
License
Feather is open-source software, licensed under the MIT License.
Acknowledgments
Feather is inspired by the simplicity of Express.js and aims to bring similar productivity to the Rust ecosystem. Special thanks to the Rust community for their contributions to building robust tools and libraries.
Known Issues
- The Logger Middleware decreases performance