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

Add koa example #1652

Merged
merged 4 commits into from
Feb 5, 2023
Merged

Add koa example #1652

merged 4 commits into from
Feb 5, 2023

Conversation

richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Jan 12, 2023

Notify

r? @stripe/api-library-reviewers

Summary

Adds an example that uses koa.js to our examples/ folder.

I originally thought this would be trivial. The result looked simple but I unfortunately struggled for hours trying to get a handle on the raw bodyusing standard-ish koa node modules. The koa-bodyparser README contains pretty clear instructions, but I did not find those at first, because I tried to copy and paste the express example and just modify it for Koa. In our express example, we skip the body-parsing middleware in the case of webhooks, which is not the right approach for Koa, or at least I couldn't figure out how to access the raw body that way.

Motivation

Fixes #1435.

@pakrym-stripe
Copy link
Contributor

nit: r? https://github.com/orgs/stripe/teams/api-library-reviewers doesn't work on github.com so no one got assigned to the PR.

@pakrym-stripe pakrym-stripe merged commit 22cc651 into master Feb 5, 2023
@remi-stripe remi-stripe deleted the richardm-koa-example branch September 28, 2023 16:29
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.

Koa JS exemple for using webhook and parsing raw body
2 participants