Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Route dependency checking PoC

node v14.20.1
endpointsharetweet
const Hapi = require('@hapi/hapi'); const server = Hapi.server(); await server.register({ name: 'app', register(srv) { srv.events.on('route', ({ realm, settings }) => { // If this route originates from this plugin and has dependencies // then add a dependency to this plugin on behalf of the route. if (realm === srv.realm && settings.app.dependencies) { srv.dependency(settings.app.dependencies); } }); srv.route({ method: 'get', path: '/', options: { app: { dependencies: ['inert'] } }, handler: (request, h) => h.file('./my-file') }); } }); await server.initialize();
Loading…

no comments

    sign in to comment