How to use server-timing - 1 common examples

To help you get started, we’ve selected a few server-timing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github recruit-tech / redux-pluto / src / server / index.ts View on Github external
export default function renderer({
  clientStats,
  server,
  sessionStore,
  promises,
}: any) {
  const app = express.Router();

  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded(config.bodyParser.urlencoded));
  app.use(cookieParser(config.cookieParser as any));
  app.use(session({ store: sessionStore, ...config.session }));
  app.use(csurf(config.csurf));
  app.use(serverTiming());
  app.use(favicon(config.favicon));
  app.use(useragent.express());

  if (!__DEVELOPMENT__) {
    const assetsHandler = new AssetsHandler(clientStats.assets);
    app.use(
      clientStats.publicPath,
      assetsHandler.handleUrl.bind(assetsHandler),
    );
  }

  config.assets.forEach(asset => {
    app.use(asset.mount, express.static(asset.path));
  });

  app.use(config.clientConfig.fetchr.xhrPath, apiGateway(config, app));

server-timing

This module can add `ServerTiming` Header to http response, and be able to use express middleware

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular server-timing functions