seanmonstar / warp

A super-easy, composable, web server framework for warp speeds.
https://seanmonstar.com/post/176530511587/warp
MIT License
9.58k stars 719 forks source link

Adding "data" / "state" helpers #748

Open masklinn opened 3 years ago

masklinn commented 3 years ago

Is your feature request related to a problem? Please describe. Basically when looking at warp initially, one thing which isn't entirely clear is how to attach application state to filters.

any has examples if / when one stumbles on it, but it feels like for the common cases there could be simple filters available out of the box for the most common cases, either in the any module or in a data or state module.

Describe the solution you'd like I think useful data / state filters would be:

If these were built on top of any I guess they could also make the typing clearer, or maybe that should be documented separately? e.g. how to type helper functions when extracting routes into submodules or creating utility filters.

Describe alternatives you've considered Providing more of a "how to", or maybe a small list of common warp patterns, at the root of the documentation (either after Filters or as a sub-section).

masklinn commented 3 years ago

Note: mostly asking if it would be accepted if I proposed that, and maybe discussing the layout / design if it's considered a good idea.

arniu commented 3 years ago

How about to add a filter wrapper to set extensions?