Creating a simple API route for nextjs 13
Create your nextjs 13 app via command line and then place this file 'route.ts' and paste the following content to it
your-next-js-app/api/route.ts. Then you can browser localhost:3000/api/ - it should return ok
import { NextResponse } from 'next/server'
export async function GET(request: Request) {
return NextResponse.json("Ok")
}
Comments