Firebase error in api/page-views.js
larbisahli opened this issue · comments
Larbi commented
Hello, i was reading your awesome blogs about next.js and i found bug in your page-views.js api route in blog Create a Dashboard with Next.js API Routes - Google Analytics API
Visiting the api/page-views.js route.
That route is not protected and i would love to learn from you how you can protect next.js api routes.
Cheers
Lee Robinson commented
Whoops
You can disregard it! You can protect your route by checking a secret environment variable and returning an error if they don't match.