github.com/oam-dev/kubevela@v1.9.11/docs/examples/testapp/server.js (about)

     1  'use strict';
     2  
     3  const express = require('express');
     4  // const promMid = require('express-prometheus-middleware');
     5  
     6  // Constants
     7  const PORT = 8080;
     8  const HOST = '0.0.0.0';
     9  
    10  // App
    11  const app = express();
    12  app.get('/', (req, res) => {
    13      res.send('Hello World');
    14  });
    15  
    16  // expose metrics:
    17  // - https://www.npmjs.com/package/express-prometheus-middleware
    18  // - https://medium.com/teamzerolabs/node-js-monitoring-with-prometheus-grafana-3056362ccb80
    19  // app.use(promMid({
    20  //     metricsPath: '/metrics',
    21  //     collectDefaultMetrics: true,
    22  //     requestDurationBuckets: [0.1, 0.5, 1, 1.5],
    23  // }));
    24  
    25  app.listen(PORT, HOST);
    26  console.log(`Running on http://${HOST}:${PORT}`);
    27