Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.29 KB

mongodb-storage.md

File metadata and controls

63 lines (44 loc) · 1.29 KB

Errsole with MongoDB

Install

Install the errsole and errsole-mongodb modules using the npm install command:

npm install errsole errsole-mongodb

Configure

// CommonJS
const errsole = require('errsole');
const ErrsoleMongoDB = require('errsole-mongodb');
// ESM and TypeScript
import errsole from 'errsole';
import ErrsoleMongoDB from 'errsole-mongodb';
// Insert the Errsole code snippet at the beginning of your app's main file
errsole.initialize({
  storage: new ErrsoleMongoDB('<MongoDB Connection URL>', '<Optional: Database Name>', '<Optional: MongoDB Client Options>')
});

Example

const express = require('express');
const errsole = require('errsole');
const ErrsoleMongoDB = require('errsole-mongodb');

// Insert the Errsole code snippet at the beginning of your app's main file
errsole.initialize({
  storage: new ErrsoleMongoDB('mongodb://localhost:27017/', 'logs')
});

const app = express();

app.get('/', function (req, res) {
  res.send('Hello World');
});

app.listen(3000);

Advanced Configuration

Advanced Configuration

Web Dashboard Access

Web Dashboard Access

Main Documentation

Main Documentation