How to use the librato-node.middleware function in librato-node

To help you get started, we’ve selected a few librato-node 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 ello / webapp / src / server / iso.js View on Github external
const data = logfmt.requestLogger.commonFormatter(req, res)
  data.useragent = req.headers['user-agent']
  return data
}))

// Parse cookies (for determining to pre-render or not)
app.use(cookieParser())

// Send stats to Librato
librato.configure({
  email: process.env.LIBRATO_EMAIL,
  token: process.env.LIBRATO_TOKEN,
  source: process.env.DYNO,
})
librato.start()
app.use(librato.middleware())

librato.on('error', (err) => {
  console.log('[librato] ERROR', err)
})

// Use Helmet to lock things down
app.use(helmet())

const indexStr = fs.readFileSync(path.join(__dirname, './../../public/index.html'), 'utf-8')
const stats = JSON.parse(fs.readFileSync(path.join(__dirname, './../../webpack-stats/server.json'), 'utf-8'))

// Wire up OAuth route
addOauthRoute(app)

// Assets
app.use(express.static('public', { index: false, redirect: false }))

librato-node

A node.js client for Librato Metrics (http://metrics.librato.com/)

MIT
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis