DEV Community

Ryo Kuroyanagi
Ryo Kuroyanagi

Posted on

Legacy pages/api works in App Router Next.js project

TL;DR

pages/api directory works even in projects that are using App Router.

Why I wrote this doc?

I tried to use Auth0 library in my Next.js project and I'm using App Router. I faced a problem that I can not use Auth0 library in the manner of app directory API routing because the library provides only a handler for the legacy pages/api. However, I noticed that even in the project, I can use the legacy pages/api directory.

This is my example code.

Hope this helps.

Top comments (0)