ExpressJS (Node.js)

Node.js applications with ExpressJS can use the @logbee/express package to send the requests and logs to Logbee.

Working example can be found on the ExpressJS integration page.

@logbee/express
index.js
const express = require('express');
const { logbee } = require('@logbee/express');

const app = express();
const port = 3000;

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use(logbee.middleware({
    organizationId: '_OrganizationId_',
    applicationId: '_ApplicationId_',
    logbeeApiUri: 'https://api.logbee.net'
}));

app.get("/", (req, res) => {
    const logger = logbee.logger(req);

    logger?.info('Hello World! from ExpressJS');
    res.send('ok');
});

app.use(logbee.exceptionMiddleware());

app.listen(port, () => {
    console.log(`[server]: Server is running at http://localhost:${port}`);
});

For technical support, questions or any feedback, please feel free to send us a message and we will get back to you.