MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / middleware

Function middleware

Video 126/middleware/middleware.js:17–25  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

15import { NextResponse } from 'next/server'
16
17export function middleware(request) {
18 if (request.nextUrl.pathname.startsWith('/about')) {
19 return NextResponse.rewrite(new URL('/', request.url))
20 }
21
22 if (request.nextUrl.pathname.startsWith('/dashboard')) {
23 return NextResponse.redirect(new URL('/', request.url))
24 }
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected