Install the errsole
and errsole-postgres
modules using the npm install command:
npm install errsole errsole-postgres
// CommonJS
const errsole = require('errsole');
const ErrsolePostgres = require('errsole-postgres');
// ESM and TypeScript
import errsole from 'errsole';
import ErrsolePostgres from 'errsole-postgres';
// Insert the Errsole code snippet at the beginning of your app's main file
errsole.initialize({
storage: new ErrsolePostgres({
host: 'postgres-host', // Replace with your actual PostgreSQL host
user: 'database-user', // Replace with your actual PostgreSQL user
password: 'database-password', // Replace with your actual PostgreSQL password
database: 'database-name' // Replace with the name of your PostgreSQL database
})
});
const express = require('express');
const errsole = require('errsole');
const ErrsolePostgres = require('errsole-postgres');
// Insert the Errsole code snippet at the beginning of your app's main file
errsole.initialize({
storage: new ErrsolePostgres({
host: 'localhost',
user: 'root',
password: 'password',
database: 'dbname'
})
});
const app = express();
app.get('/', function (req, res) {
res.send('Hello World');
});
app.listen(3000);