npm.io
1.0.0 • Published 6 years ago

server-timi

Licence
MIT
Version
1.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
6

server-timi

Current Version Build Status via Travis CI Dependencies belly-button-style

Server timing API plugin for hapi.

Example

server-timi does not accept any options. To use it, register the plugin with a hapi server, and the Server-Timing header will be automatically added to the server's responses.

'use strict';
const Hapi = require('@hapi/hapi');
const ServerTimi = require('server-timi');

async function main () {
  const server = Hapi.server({ port: 8080 });

  await server.register({ plugin: ServerTimi });

  server.route({
    method: 'GET',
    path: '/foo',
    handler (request, h) {
      return { foo: 'bar' };
    }
  });

  await server.start();
}

main();

Keywords