Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async handling; Controller protocol; Path/handler conveniences #526

Open
wants to merge 9 commits into
base: stable
Choose a base branch
from

Conversation

namolnad
Copy link

@namolnad namolnad commented Jul 31, 2022

Hi there 👋

This PR is mostly to gauge interest in a few changes I've made to a forked copy of this package. I can very easily split this up into many PRs if there is interest in any/all of this, but first wanted to see how it was received. Thanks for having a look!

Included Changes

  1. Support Async/Await
    a. Allows use of async/await to make async extremely simple
  2. Fix file dir handling
    a. Noticed files within directories were broken
  3. Exclude DemoServer from package
    a. Slim out the package
  4. Add controller protocol and convenience subscript
    a. Allows GET["your/route"] = MyController.myRouteHandler
    i. The above would be possible for the following: struct MyController: Controller { func myRouteHandler(_ request: HttpRequest) async -> HttpResponse {
  5. Enable registering multiple paths for a given handler
    a. Allows GET["my/first/route", "my_other_route"] = { request in }
  6. Trim : from request parameters
    a. Allows request["parameterName"] vs request[":parameterName"] as a more convenient/intuitive accessor.
    i. Addresses Strip ':' from param keys  #489

@namolnad
Copy link
Author

(Worth noting there are some CI issues and OS version items that will need to be sorted out if these changes are desirable for others besides myself)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant