Create an API endpoint at api/crons/delete_old_sessions and via a DELETE request, the sessions that were last active more than 7 days ago will be deleted from the database. The only condition is that the Authorization header must equal to Bearer ${env.CRON_SECRET} (CRON_SECRET needs to be added to .env.example right below JWT_SECRET).
This route will run via a cron job I've yet to implement/host (this last bit is something I'll do).
Create an API endpoint at
api/crons/delete_old_sessions
and via a DELETE request, the sessions that were last active more than 7 days ago will be deleted from the database. The only condition is that theAuthorization
header must equal toBearer ${env.CRON_SECRET}
(CRON_SECRET
needs to be added to.env.example
right belowJWT_SECRET
).This route will run via a cron job I've yet to implement/host (this last bit is something I'll do).