-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Package: Express-like Response Helpers #14
Comments
Potentially required built-ins (must needed) have to be listed...? |
Sorry, don't understand what you mean |
IMHO a list of must needed Express built-ins need to be made. Can't implement all of them right? |
Would this be implemented as a middleware that would go on an Because I kinda have something I would like to flesh out a bit more and maybe include here. |
I have 85% of the response helpers done now :) right now, some of the "big" ones are their own packages (eg, send, sendfile, redirect) but the others are grouped together and available as their own exports. I think this will be a import { link, download } from '@polka/response';
polka()
.get('*', (req, res) => {
link(res, ...);
}) These imports are just like the current "send" package. They operate independently/don't need to be used inside Polka at all. I might also be re-exporting those bigger packages (send, redirect, etc) from this package too. Not sure yet. Finally, and probably more importantly, there's a import compat from `@polka/compat`;
polka()
.use(compat)
.get((req, res) => {
res.set('X-Foo', 'custom header');
res.status(200).json({ foo: 123 });
}) I haven't released his components yet in a |
Both The only thing that's holding me back from switching to polka from express for old projects. |
What is the status of this, @lukeed? Really looking forward to this! |
Thanks! I'm trying to carve out a chunk of time so that I can finish the entire Polka 1.0 suite in a 1-2 week push. All the big pieces are done – just need some documentation and some more tests. As for this issue specifically, some of the smaller utilities are not done but they may not be needed at all. The bigger pieces of this issue left TBD are cookies & fresh |
Glad to hear it! The main helper we need is res.redirect; is that included in 1.0? |
Yes :) |
@talentlessguy Please do not go around advertising your framework in issues. Good practice in general. |
@lukeed I'm sorry, I just thought these extensions would be useful for ppl who use polka and have to rewrite them from scratch |
Ported from #5:
This is a low(er) priority, but would definitely be helpful for those who can't live without the Express built-ins. 😆
The text was updated successfully, but these errors were encountered: