Next.js Discord

Discord Forum

better option for Authorization than middleware

Unanswered
Shashank posted this in #help-forum
Open in Discord
Avatar
So I'm currently using middleware to check if the user is logged in (using clerk) .
I m then doing the Authorization using postgresql (with drizzle orm). Now the issue is that it is a bit too expensive for the database.
Is there someway I can cache the data or someway to do it outside of middleware.
Also today it seems that middleware was having issues with response time if db fetching is involved. I was repeatedly getting 504 time out error

1 Reply

Avatar
bump