https://supertokens.com/ logo
Do I have to run supertokens.init() for every api route in Next.js if
n

Nightlight

01/25/2023, 3:18 AM
Do I have to run supertokens.init() for every api route in Next.js if I am not deploying in a serverless environment?
r

rp

01/25/2023, 5:02 AM
U don’t have to run that if not deployed in serverless env.
n

Nightlight

01/25/2023, 5:05 AM
Where would be the appropriate place to call this in a non serverless env? in the _app.tsx file?
r

rp

01/25/2023, 5:09 AM
Yea. If you knows it’s the backend and not the frontend. So maybe call it when something like process.env is not undefined. Not sure what the right check is
n

Nightlight

01/25/2023, 5:11 AM
I think it's just typeof window === 'undefined'
r

rp

01/25/2023, 5:14 AM
Yes. Maybe. Would need test