MCPcopy Create free account
hub / github.com/code100x/daily-code / GET

Function GET

apps/web/app/api/revalidate/route.ts:4–19  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

2import { NextRequest, NextResponse } from "next/server";
3
4export async function GET(req: NextRequest) {
5 const fromQuery = req.nextUrl.searchParams.get("secret");
6 const path = req.nextUrl.searchParams.get("path");
7
8 if (fromQuery != process.env.MY_SECRET_TOKEN) {
9 return NextResponse.json({ message: "Invalid token" }, { status: 401 });
10 }
11 try {
12 if (path) {
13 revalidatePath(path);
14 return NextResponse.json({ revalidated: true, now: Date.now() });
15 }
16 } catch (e) {
17 return NextResponse.json({ message: "Error revalidating" }, { status: 500 });
18 }
19}

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected