D
Deno

help

Is there an event that triggers when an Oak Deploy instance is closing?

SSkepticMystic11/29/2022
I cannot find anything in the Deploy docs, specifically. But I see that the Oak app runs a callback when the server closes. Something like this should work, I think:
app.listen({ port: 8080 }).then(() => {
console.log('Shutting down...');
db.collection('test').insertOne({ createdAt: new Date() })
});
app.listen({ port: 8080 }).then(() => {
console.log('Shutting down...');
db.collection('test').insertOne({ createdAt: new Date() })
});
But the console log doesn't run. Maybe the way Deploy closes instances doesn't allow for this? Any advice would be really helpful

Looking for more? Join the community!