Download next.js/test/e2e/app-dir/actions/middleware-node.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 452 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/middleware-node.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/middleware-node.js
-
curl -L -o middleware-node.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/middleware-node.js
452 Bytes
| // Ensure that https://github.com/vercel/next.js/issues/56286 is fixed. | |
| import { NextResponse } from 'next/server' | |
| export async function middleware(req) { | |
| if (req.nextUrl.pathname.includes('rewrite-to-static-first')) { | |
| req.nextUrl.pathname = '/static/first' | |
| return NextResponse.rewrite(req.nextUrl) | |
| } | |
| return NextResponse.next() | |
| } | |
| /** | |
| * @type {import('next/server').MiddlewareConfig} | |
| */ | |
| export const config = { | |
| runtime: 'nodejs', | |
| } | |