Commit Graph
31 Commits
Author SHA1 Message Date
David Pedersen 356f1c8424 Generic request body (#22)
Fixes #21
2021-06-19 12:50:33 +02:00
David Pedersen c41c9e0f78 Support extracting URL params multiple times (#15)
Useful when building higher order extractors.
2021-06-13 13:06:33 +02:00
David Pedersen 1002685a20 Rename to awebframework (#13) 2021-06-13 11:22:02 +02:00
David Pedersen 59944c231f Reduce size of response body types (#11)
Wrapping everything in `crate::body::Either` wasn't actually necessary
ans probably causes large body types. You can instead box the bodies in
the leaf services.
2021-06-13 10:10:37 +02:00
David Pedersen 04d62798b6 Reduce body boxing (#9)
Previously, when routing between one or two requests the two body types
would be merged by boxing them. This isn't ideal since it introduces a
layer indirection for each route.

We can't require the services to be routed between as not all services
use the same body type.

This changes that so it instead uses an `Either` enum that implements
`http_body::Body` if each variant does. Will reduce the overall
allocations and hopefully the compiler can optimize things if both
variants are the same.
2021-06-12 23:59:18 +02:00
David Pedersen b3bc4e024c Add RoutingDsl::{serve, into_make_service} (#8) 2021-06-12 21:44:40 +02:00
David Pedersen c9c507aece Add support for websockets (#3)
Basically a copy/paste of whats in warp.

Example usage:

```rust
use tower_web::{prelude::*, ws::{ws, WebSocket}};

let app = route("/ws", ws(handle_socket));

async fn handle_socket(mut socket: WebSocket) {
    while let Some(msg) = socket.recv().await {
        let msg = msg.unwrap();
        socket.send(msg).await.unwrap();
    }
}
```
2021-06-12 20:50:30 +02:00
David Pedersen c91dc7ce29 Make Request<Body> an extractor 2021-06-09 09:42:06 +02:00
David Pedersen 21872c9f7a Remove some unnecessary dependencies 2021-06-08 22:27:38 +02:00
David Pedersen 1f8b39f05d More docs and expand key_value_store example 2021-06-08 12:43:16 +02:00
David Pedersen d376e49eb9 More docs 2021-06-07 16:28:40 +02:00
David Pedersen d8b0153939 Write some more docs 2021-06-07 15:45:19 +02:00
David Pedersen 21c96e0aa1 Write a few docs 2021-06-06 23:58:44 +02:00
David Pedersen 46f74895ce Remove duplicated HandleError 2021-06-06 22:43:53 +02:00
David Pedersen 7620f17edc Remove some needless type params 2021-06-06 22:41:52 +02:00
David Pedersen 1609191a74 Nesting and more flexible routing dsl 2021-06-06 20:30:54 +02:00
David Pedersen a005427d40 Write some docs 2021-06-06 15:19:54 +02:00
David Pedersen 46398afc72 Move things around a bit 2021-06-06 11:37:08 +02:00
David Pedersen c3977d0b71 Change routing DSL 2021-06-04 01:00:48 +02:00
David Pedersen e156bc40e1 not quite working 2021-06-03 21:36:39 +02:00
David Pedersen 00737c4e0a checkpoint 2021-06-02 22:07:37 +02:00
David Pedersen 0d7e1e74c4 Adding layers to the whole thing 2021-06-01 21:15:48 +02:00
David Pedersen 90b9dffce7 Add remaining routing methods 2021-06-01 12:25:28 +02:00
David Pedersen f690e74275 Support nesting services with error handling 2021-06-01 11:23:56 +02:00
David Pedersen 093ad3622e Some simplifications 2021-06-01 08:32:58 +02:00
David Pedersen 0e38037c74 More error handling 2021-06-01 00:37:07 +02:00
David Pedersen 19cbece1dc Rename error type 2021-05-31 20:53:03 +02:00
David Pedersen f6b1a6f435 More work 2021-05-31 16:28:26 +02:00
David Pedersen 6822766165 Add Html response type 2021-05-31 10:20:07 +02:00
David Pedersen 763d4e8d21 Routing with dynamic parts! 2021-05-30 15:44:26 +02:00
David Pedersen f4268471b6 Break things into modules 2021-05-30 13:24:03 +02:00