How to use universal-cookie-koa - 1 common examples

To help you get started, we’ve selected a few universal-cookie-koa 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 wavesplatform / wavesplatform.com / src / server / index.js View on Github external
import router from './routes';
import { readAssets } from './middleware/readAssets';
import serverErrorHandling from './middleware/serverErrorHandling';
import accessLog from './middleware/accessLog';
import initLogger from './middleware/initLogger';
import serveStatic from './middleware/serveStatic';
import sniffLocale from './middleware/sniffLocale';

const app = new Koa();

app
  // add logger to context
  .use(initLogger)
  .use(accessLog)
  .use(serverErrorHandling)
  .use(cookiesMiddleware())
  .use(bodyParser())
  .use(sniffLocale)
  .use(serveStatic)
  .use(readAssets)
  .use(router.routes());

if (process.env.NODE_ENV === 'production') {
  app.on('error', err => {
    Raven.captureException(err, (err, eventId) => {
      console.log('Reported error ' + eventId);
    });
  });
}

app.listen(3001);

universal-cookie-koa

Hook cookies get/set on Koa for server-rendering

MIT
Latest version published 23 days ago

Package Health Score

78 / 100
Full package analysis

Popular universal-cookie-koa functions