1.0.0 • Published 4 years ago

server-timi v1.0.0

Weekly downloads
25
License
MIT
Repository
github
Last release
4 years ago

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();