-
Notifications
You must be signed in to change notification settings - Fork 2
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
add support for edge #82
base: main
Are you sure you want to change the base?
Conversation
source: "/:path*", | ||
destination: "/api/:path*", | ||
}, | ||
// REVIEW: I was not able to make the redirect work |
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.
I could not make the redirect work, maybe there is some issue with having /app and /pages simultaneously.
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.
yea it's ok to not have /pages and /app simultaneously 👍 we should support app directory but that's non-critical for now
...((globalMiddlewares || []) as []), | ||
auth_middleware, | ||
...((spec.middlewares || []) as []), | ||
// we don't need the withMethods middleware in Edge |
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.
we don't need the withMethods middleware in Edge
addOkStatus | ||
}: { | ||
addIf?: (req: NextloveRequest) => boolean | ||
addOkStatus?: boolean |
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.
I couldn't find a way to put the addOkStatus in the exception middleware, so I put it here and it's working fine
I think we can opt-in specific routes without using |
export const GET = withRouteSpecEdge(route_spec)((req) => { | ||
return req.responseEdge.status(200).json({ return: true }) |
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.
maybe mirroring the interface of non-edge with
export const GET = withRouteSpecEdge(route_spec)((req) => { | |
return req.responseEdge.status(200).json({ return: true }) | |
export const GET = withRouteSpecEdge(route_spec)((req, res) => { | |
return res.status(200).json({ return: true }) |
would be a bit easier to use (since responseEdge
is already an artificial construct anyways)?
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.
// { | ||
// source: "/:path*", | ||
// destination: "/api/:path*", | ||
// }, |
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.
@itelo I think it would be a lot better if we created an example-edge-todo-app
instead of modifying the existing one, we can merge them later, but for now changing this file is too difficult because it's not clear if you're introducing a regression
This PR contains a LOT of stuff, and will probably be split into some PRs
After that, we are good to go.
The final result is:
Note that:
responseEdge
,edgeBody
, andedgeQuery
are variable names just to make it work, I'll appreciate it with you have better names.