mjkillough / aitch Goto Github PK
View Code? Open in Web Editor NEWaitch is a simple, lightweight toolkit for building HTTP servers in Rust, loosely based on Go's net/http.
License: MIT License
aitch is a simple, lightweight toolkit for building HTTP servers in Rust, loosely based on Go's net/http.
License: MIT License
Emojis and colour!
We currently define aitch::Error
to be an alias for Box<Error>
.
This was because:
Since making this decision, we added the handler::static_files
handlers, which attempt to catch io::Error
and display a HTTP 404. These currently downcast the Box<Error>
, which feels a little gross. Is there a better way?
Would aitch be more powerful if it somehow allowed users to specify a custom error type? What would that API look like?
Feedback very welcome!
The aitch crate was originally meant to define just the types necessary to create handlers/middlewares/bodies. The server backends and other middlewares were going to be defined in separate crates.
For ease of development, the other features were added to the main aitch crate, behind default-on optional cargo features. Should they be split out into separate crates? It would keep the main aitch crate small (as was intended), but make it more difficult for end-users to use.
The crate could be split by:
aitch_hyper
: Hyper back-end.aitch_tiny_http
: tiny_http back-endaitch_json
: Serde supportaitch_static_files
: Static file serving. (Although this might give the impression that it's production ready).aitch_simple_router
: SimpleRouter
, although maybe there should be a better aitch_router
crate.We currently have implementations for two back-ends: Hyper and HTTP. Both expose a Server
struct with a common interface.
So far they do not share a trait, but perhaps they should? Would this limit us from supporting other back-ends in the future, if they're unable to implement the trait for whatever reason? (Maybe they can't get the local addr they're bound to).
Would applications ever want to be generic over the server back-end used? That would be the biggest motivating factor for adding a trait.
The crate provides SimpleRouter
, which is primarily an example of how one might build a router or other complex middleware.
We should also provide (possible in a separate crate), a more production ready router, with features like:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.