Request interceptor for pre-handle & post handle for any API Endpoint or Web Page #63039
developershyam
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
I want to execute logic before request send to any API / Web Page to be executed which can be called request pre-handle interceptor.
And after that my API / Page logic execution I want to do request post-handle which I feel missing in NextJs built-in function.
It's just like in any other framework we have this feature. They provide filter chain that can control request/response.
Pre-Handle can be achieved by middleware.
Post-Handle missing??
One way is it can be done via custom server like express.
Goal: Need feature to take more control on request processing
Non-Goals
No response
Background
As other framework allows us to do request pre-processing & post-processing.
This is really useful & provide more flexibility in framework when someone want to do their own customization on top of framework.
Proposal
I am interested in if middleware can handle this like in express or any node-based server does.
Until you call NextResponse.next() the request should not go inside the API/Endpoint.
This will allow to take control & manage stuff at their own end.
As middleware is supporting only Edge Runtime.
Is there any better way to intercept request before & after any API/Page execution in full node runtime?
Framework should delegate power to the consumer if needed that will be fantastic.
Beta Was this translation helpful? Give feedback.
All reactions