Conversation
| source: "/:path*", | ||
| destination: "/api/:path*", | ||
| }, | ||
| // REVIEW: I was not able to make the redirect work |
There was a problem hiding this comment.
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.
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.
we don't need the withMethods middleware in Edge
| addOkStatus | ||
| }: { | ||
| addIf?: (req: NextloveRequest) => boolean | ||
| addOkStatus?: boolean |
There was a problem hiding this comment.
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.
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)?
| // { | ||
| // source: "/:path*", | ||
| // destination: "/api/:path*", | ||
| // }, |
There was a problem hiding this comment.
@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, andedgeQueryare variable names just to make it work, I'll appreciate it with you have better names.