FlyingFox icon indicating copy to clipboard operation
FlyingFox copied to clipboard

Support for URL parameters

Open tonyarnold opened this issue 1 year ago • 2 comments

Vapor and Hummingbird both have a great feature where you can specify post parameters as part of the URL/Route using the form:

/ax/objects/:id

Where :id is accessible as a parameter that is replaced by the passed value.

It would be great to have this same support in FlyingFox at some point!

tonyarnold avatar Jun 05 '24 09:06 tonyarnold

Ah nice, the preview/macro branch provides a glimpse of what I want it to eventually achieve when macros become feasible to use in lightweight packages.

My plan is to eventually match some elements within the route to the handler as named parameters removing the need to force unwrap:

@HTTPRoute("/ax/objects/:id")
func getObject(id: Int) -> HTTPResponse

My imagination had struggled to think up what this future syntax would be maybe {id} but I'm happy to follow prior art here.

swhitty avatar Jun 06 '24 10:06 swhitty

I've started an implementation of this that builds on the changes in #91 at: tonyarnold#1

tonyarnold avatar Jun 14 '24 04:06 tonyarnold

Released in 0.15.0

swhitty avatar Jul 15 '24 00:07 swhitty