Tela
Rust based web design :smile:
Construct endpoints or error handlers like so.
use *;
// This is a text/plain response
use ;
// This is a text/html response that could fail and the error should be either
// given to the appropriate handler or returned as is.
use ;
// Catches any error that is 404 comming from another endpoint
// soon this will be for all 404 errors that are thrown
// All returns must be valid data. There can not be custom HTTP codes or results
// returned.
use ;
// Endpoint that returns json with a custom HTTP code. This response is not
// caught by any other handlers.
// The `Raw` type can be used inside of a JSON type to represent a shapeless object.
use ;
use ;
// The query and body can automatically be extracted from the request in the parameters.
// Just use `Body` and `Query`. If a extraction or a uri capture could be missing or you don't want
// Tela throwing a 500 error automatically, you can wrap the parameters type in an `Option`.
// Also note that the order of the parameters are not important.
Run an app like so.
use ;
asyn
TODO:
- Built it timeout, throtteling, etc... with
Tower - HTTP/1 and HTTP/2 Support (Currently only HTTP/1)
Inspiration
Tools
-
Hyper - Focus on
1.0 release -
typed-html for html macro inspiration and html-to-string-macro for html responses.