nextjs 13 protected api routes

What is the best way to protect api in the new nextjs release, something like an internal middleware?
6 Replies
Neto
Neto15mo ago
app dir or pages dir?
Neto
Neto15mo ago
Next.js API Routes | Clerk
Set up API routes to gather data into your Next.js app
Neto
Neto15mo ago
but something like this
notfiliberto
notfiliberto15mo ago
app dir, I just want to run a middleware on some endpoint to check if the user is authenticated or not
Neto
Neto15mo ago
Neto
Neto15mo ago
Check clerk example on that You can easily change that around what you need