Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

hawtio/hawtio-backend-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

92b1274 · Apr 23, 2024

History

28 Commits
Oct 6, 2022
Oct 5, 2022
Oct 23, 2023
Oct 24, 2023
Oct 24, 2023
Oct 4, 2022
Oct 5, 2022
Oct 23, 2023
Oct 4, 2022
Oct 23, 2023
Oct 24, 2023
Oct 4, 2022
Apr 23, 2024
Oct 30, 2022
Oct 24, 2023
Oct 5, 2022
Oct 4, 2022
Oct 23, 2023

Repository files navigation

Hawtio Backend Middleware for Express

Test

An Express middleware that implements Hawtio backend.

Installation

NPM

npm install --save-dev @hawtio/backend-middleware

Yarn

yarn add --dev @hawtio/backend-middleware

Usage

You can use this backend with Express as follows:

const express = require('express');
const { hawtioBackend } = require('@hawtio/backend-middleware');

const app = express();
app.get('/', (req, res) => {
  res.send('hello!');
});
app.use('/proxy', hawtioBackend({
  // Uncomment it if you want to see debug log for Hawtio backend
  logLevel: 'debug'
}));
app.listen(3333, () => {
  console.log('started');
});

To use it with Webpack, set up dev server's middlewares as follows:

const { hawtioBackend } = require('@hawtio/backend-middleware')

module.exports = {
  devServer: {
    setupMiddlewares: (middlewares) => {
      middlewares.unshift({
        name: 'hawtio-backend',
        path: '/proxy',
        middleware: hawtioBackend({
          // Uncomment it if you want to see debug log for Hawtio backend
          logLevel: 'debug',
        })
      })

      return middlewares
    }
  }
}