How do you gracefully shutdown in Nuxt3

218 Views Asked by At

I'm trying to disconnect from the database when the server is shutting down in Nuxt3.
This used to work in Nuxt 2
enter image description here
but it doesn't work anymore in Nuxt3.

Writing the code in the "ready" hook in nuxt.config.ts doesn't help either.
Also, I tried a simple "console.log('something')" in the "close" hook but didn't appear in the console either when I pressed ctrl+c

Does anyone know how I can do this in Nuxt3?

0

There are 0 best solutions below