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

cloud.Api catch-all route handler #3983

Open
Chriscbr opened this issue Aug 28, 2023 · 4 comments
Open

cloud.Api catch-all route handler #3983

Chriscbr opened this issue Aug 28, 2023 · 4 comments
Labels
✨ enhancement New feature or request 🎨 sdk SDK

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Aug 28, 2023

Feature Spec

A preflight API for running inflight code that should run on all uncaught routes of a cloud.Api:

bring cloud;

let api = new cloud.Api();

api.get("/users/*", inflight (req) => { /* ... */ });
api.get("*", inflight (req) => { /* ... */ });

Since req: cloud.ApiRequest includes path as a field, the inflight function can perform custom logic based on the actual route the user passed.

Related to #3973, #1848

Use Cases

Specifying custom responses for when a request doesn't match any of the other routes you've specified on your cloud.Api.

This kind of capability is available in other frameworks like Express.js using the "*" syntax (see examples here) and SST using the "{proxy+}" path variable (docs).

Implementation Notes

No response

Component

SDK

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Chriscbr Chriscbr added ✨ enhancement New feature or request 🎨 sdk SDK labels Aug 28, 2023
@monadabot monadabot added this to Wing Aug 28, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Aug 28, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Aug 29, 2023
@staycoolcall911 staycoolcall911 added the needs-discussion Further discussion is needed prior to impl label Oct 4, 2023
Copy link

github-actions bot commented Dec 7, 2023

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@skorfmann
Copy link
Contributor

This would be pretty handy for cases where people would wanna use 3rd party frameworks. here's an example winglang/examples#45

@Chriscbr Chriscbr removed the needs-discussion Further discussion is needed prior to impl label Feb 27, 2024
Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Sep 21, 2024
@Chriscbr Chriscbr removed the Stale label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request 🎨 sdk SDK
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants