How to use @promster/server - 2 common examples

To help you get started, we’ve selected a few @promster/server 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 aragon / apm-serve / index.js View on Github external
// Error handler
app.use(function (err, req, res, next) {
  console.error('Error', err)
  res.status(503).send({ error: err.message })
})

const port = process.env.PORT || 3000
app.listen(port, (err) => {
  if (err) return console.error(err)
  signalIsUp()
  console.log(`Listening on port ${port} (host: ${process.env.APMSERVE_HOST})`)
})

const metricsPort = process.env.METRICS_PORT || 3001
createServer({ port: metricsPort }).then(server =>
  console.log(`@promster/server started on port ${metricsPort}.`)
);
github blockstack / app.co / server.js View on Github external
getApps(apiServer).then((apps) => {
    const server = express()
    server.use(createPrometheusMiddleware({ app: server }))

    // Create `/metrics` endpoint on separate server
    if (!dev) {
      createServer({ port: 9153 }).then(() => console.log(`@promster/server started on port 9153.`))
    }

    if (!dev) {
      server.use(secure);
      server.use(morgan('combined'));
    }
    server.use(cookiesMiddleware());
    server.use(compression());

    if (process.env.AUTH_PASSWORD) {
      server.use(
        basicAuth({
          users: { admin: process.env.AUTH_PASSWORD },
          challenge: true
        })
      );

@promster/server

Server exposing metrics under GET /metrics

MIT
Latest version published 7 months ago

Package Health Score

74 / 100
Full package analysis

Popular @promster/server functions