hapijs / hapi

The Simple, Secure Framework Developers Trust

Home Page:https://hapi.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reg onPostStop is not executing statements inside method

vinaykumar612 opened this issue · comments

Support plan

  • is this issue currently blocking your project? (yes/no):no
  • is this issue affecting a production system? (yes/no):no

Context

  • node 17.9.1:
  • @hapi/hapi 20.2.1:
  • node (e.g. node, browser, native):
  • hapi (e.g. hapi application, another framework, standalone, ...):
  • any other relevant information:

How can we help?

server.ext({
      type: 'onPostStop',
      method (request, reply) {
        console.log('Application stopped');
      },
});

Sorry, we'll need a lot more information here in order to help you! One thing that stands out in that example is that onPostStop is a server lifecycle extension, so it is not passed request as an argument. In order to trigger this extension point you need to call server.stop().