Next.js Discord

Discord Forum

How can I persist data in api routes

Unanswered
Clytax posted this in #help-forum
Open in Discord
We are using Expo notifications to send notifications from the backend (Next.js API routes). For this, we are using node-scheduler to schedule the push notifications. What we need is a way to store the 'jobs' so that when we delete an appointment, we can also delete the corresponding job.

The job is created in the '/create' route but deleted in the '/delete' route, so we need to be able to access the storage in both.

Does anyone have any ideas?

2 Replies

you will need a database, storing data in the memory is not reliable in a serverless environment because the process is not long running