leerob / leerob.io

✨ My portfolio built with Next.js, Tailwind, and Vercel.

Home Page:https://leerob.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firebase error in api/page-views.js

larbisahli opened this issue · comments

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

Screenshot 2020-09-24 162643

Visiting the api/page-views.js route.

Screenshot 2020-09-24 163012

That route is not protected and i would love to learn from you how you can protect next.js api routes.

Cheers

Whoops 😓 That was from here. #229

You can disregard it! You can protect your route by checking a secret environment variable and returning an error if they don't match.