-
Notifications
You must be signed in to change notification settings - Fork 238
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
Adds koa route #80
base: master
Are you sure you want to change the base?
Adds koa route #80
Conversation
Did not understand how they worked before
@@ -25,9 +25,10 @@ | |||
"homepage": "https://github.com/odysseyscience/react-s3-uploader", | |||
"dependencies": { | |||
"aws-sdk": "2.x", | |||
"koa-router": "^5.4.0", |
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.
Im not familiar with koa, but notice we took out the express
dependency in this file, and are just relying on people have it installed if they are using the bundled router. That keeps it so that people not using express
(or in this case koa
) don't have to download the dependency.
Is koa a large library? Does it have a lot of dependencies? If so, we should probably remove it from this file.
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.
Koa would need to be in the server.js (presumably) already to work. You'll do
const app = koa()
app.use(s3routes(options))
No real way to not already have koa.
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.
If you are using this router, the assumption would be that you already have a dependency on koa
. But if you aren't using this router, you don't want the koa
dependency, and you would get it if this line exists in package.json
. So we should delete this line from here I think. Make sense?
The options you added ( Thanks! 👍 |
@seanadkinson Express routers don't work at all in Koa. Koa to is similar to Express (same devs), but uses generators, and instead of There are a few other differences in here I should fix, like I took out the forward slash check on the key for some reason. But if there's interest I'll clean it up. Also the |
Yeah, I think we can merge. Ideally this package is split up into So we can just provide the router code that someone may or may not use, if you'd like to make the couple changes you mentioned. The main thing I want is to not download the |
@OKNoah Has any more work been done on this? I'm in favour of splitting this out into 3 packages as @seanadkinson suggested. I need this for a project, so I'm going to take the work you did and publish it separately. I'll reference this PR to give you credit |
Published as a separate package: https://www.npmjs.com/package/koa-s3-sign-upload |
No description provided.