-
Notifications
You must be signed in to change notification settings - Fork 122
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
How to operate res in nextjs project #440
Comments
Hi @zongzheng123, are you using the next app router or the next pages router? |
App router, |
Thanks for that, can you share with me a little more info about the use
case and what are you trying to achieve?
I don't think that NextAppRouter has a response object - instead the
headers are sent when the response is created.
https://nextjs.org/docs/app/building-your-application/routing/route-handlers
but there are always things that we can do - I'm asking where do you want
to set this header and what is an example use case there.
Are these headers the same for all requests - or are they request dependent?
…On Fri, May 17, 2024 at 9:44 AM Daniel Zong ***@***.***> wrote:
App router,
—
Reply to this email directly, view it on GitHub
<#440 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD65PUYBFKFAZBLZ5RGFYNLZCWRLPAVCNFSM6AAAAABH3RAAWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWHA3DEOJUHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I just try to add some cache control header to the api
|
Cool. Let me know if it get the job done
…On Fri, May 17, 2024 at 10:46 Daniel Zong ***@***.***> wrote:
I just try to add some cache control header to the api
Now i found a way to resolve that is writting a wrap function out of the
GET function exported by remultNextApp
const { POST, PUT, DELETE, GET: remultGET } = api;
export async function GET(request: Request) {
const res = await remultGET(request)
console.log('res', res, res.body)
return res
}
—
Reply to this email directly, view it on GitHub
<#440 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD65PU6C6MRMAMGN2IZYCB3ZCWYUDAVCNFSM6AAAAABH3RAAWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWHE2TANRQHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I looked into the remultNextApp definition and do not find how to operate the res object, i want to set res header to each request.
Describe the solution you'd like
Pass the res object to some event like initRequest
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: