-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: script API route configuration options #266
base: main
Are you sure you want to change the base?
feat: script API route configuration options #266
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @Blckbrry-Pi and the rest of your teammates on Graphite |
143fb32
to
ed6b983
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this add the chosen method and input data to the generated openapi spec anywhere?
It does not, thank you for reminding me to fix that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea of where this is going is good, but i don't think it's quite the right approach
if we're exposing raw rest api endpoints, we should give full control.
we should let have access to the arbritrary request and return an arbitrary response themselves. tbd on how to impelment those types; i think we'll just type it as the DOM request type and pass whatever vanilla object we have to the request (wether it's a cloudflare request or http server request).
in terms of actually running it, i think we need to split this out from scripts and make it a separate script-like file. basically:
files:
- api/login_callback.ts
- api/login_link.ts
in the module.yaml:
api:
login_callback:
method: GET
path: /a/b/{param}
tbd on what route matching we use, but we do need to be able to support wildcards (e.g. for serving dynamic http files).
so it needs to:
- validate there is no conflict in paths
- implement a very basic router
- pass a raw Request and accept a raw Response
this should end up looking sort of similar to Cloudflare workers in the sense of getitng a raw req & res: https://developers.cloudflare.com/workers/runtime-apis/request/
example use cases:
- oauth callbacks
- webhooks
- serving static webpages (we'll be hosting the admin portal this way)
e097634
to
9441fd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a test module in the tests/basic/ too
9441fd0
to
7279884
Compare
7279884
to
d6a0cf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment on thread.
also waiting on resolution of naming of api
-> ?
in the thread on slack.
598b05e
to
fbfcf4f
Compare
fbfcf4f
to
62642e0
Compare
Resolves OGBE-3