Guides  ›  Server  ›  Shutdown ← PREV NEXT →

Shutdown

With one worker, server() returns the native HTTP server.

var server = require('@nodedk/server')

var app = server({
  workers: 1,
  routes: [{ paths: '/', handler: () => 'Hello!' }]
})

process.on('SIGTERM', function () {
  app.close(function () {
    console.log('Server stopped')
  })
})

Close database connections and other plugin resources in the callback.

Next: Pages →

Tools for business systems.