[cli] Support root-level Middleware file in vc dev (#7973)

Adds initial support for a root-level `middleware.js` / `middleware.ts` file in the `vercel dev` CLI command. This leverages the existing Edge Function invoking logic in `@vercel/node`'s `startDevServer()` function and applies the necessary response / rewrites / mutations to the HTTP request based on the result of the middleware invocation.
This commit is contained in:
Nathan Rajlich
2022-06-27 12:56:32 -07:00
committed by GitHub
parent 570fd24e29
commit ee1211416f
16 changed files with 299 additions and 59 deletions

View File

@@ -0,0 +1,6 @@
export default () =>
new Response(null, {
headers: {
'x-middleware-rewrite': '/api/fn?from-middleware=true',
},
});