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

How to operate res in nextjs project #440

Open
zongzheng123 opened this issue May 17, 2024 · 5 comments
Open

How to operate res in nextjs project #440

zongzheng123 opened this issue May 17, 2024 · 5 comments

Comments

@zongzheng123
Copy link

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

@noam-honig
Copy link
Collaborator

Hi @zongzheng123, are you using the next app router or the next pages router?

@zongzheng123
Copy link
Author

App router,

@noam-honig
Copy link
Collaborator

noam-honig commented May 17, 2024 via email

@zongzheng123
Copy link
Author

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
}

@noam-honig
Copy link
Collaborator

noam-honig commented May 17, 2024 via email

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

No branches or pull requests

2 participants