Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

errsole

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

errsole - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

7

lib/errsole.js
'use strict';
const { createProxyMiddleware } = require('http-proxy-middleware');
const { createProxyMiddleware, fixRequestBody } = require('http-proxy-middleware');
const ErrsoleMain = require('./main');

@@ -63,3 +63,6 @@ const Errsole = {

target: 'http://localhost:' + this.port,
changeOrigin: true
changeOrigin: true,
on: {
proxyReq: fixRequestBody
}
});

@@ -66,0 +69,0 @@ };

{
"name": "errsole",
"version": "2.4.0",
"version": "2.4.1",
"description": "Logger with a Built-in Web Dashboard",

@@ -5,0 +5,0 @@ "keywords": [

@@ -44,32 +44,44 @@ <p align="center">

Should you encounter issues accessing port 8001, possibly due to firewall constraints, or if you prefer to host the Errsole Web Dashboard on your primary domain/port, configure the Errsole Proxy Middleware in your app. Follow these steps:
If you encounter issues accessing port 8001 due to firewall restrictions, or if you prefer to host the Errsole Web Dashboard on your primary domain/port, you can configure the Errsole Proxy Middleware in your app. Here is a step-by-step guide:
1. Specify the custom path for the Errsole Web Dashboard during the initialization of Errsole.
2. Integrate the Errsole Proxy Middleware into your app.
#### Step-by-Step Instructions
**Example:**
* Include the Errsole Proxy Middleware in your app. Specify a path in the middleware where the Errsole Web Dashboard will be accessible.
* Ensure the Errsole Proxy Middleware is the first middleware in your app. Any other middleware should be placed after it.
#### Example
```javascript
const errsole = require('errsole');
const ErrsoleMongoDB = require('errsole-mongodb');
const ErrsoleSequelize = require('errsole-sequelize');
const express = require('express');
// Initialize Errsole with storage and custom path
// Initialize Errsole
errsole.initialize({
storage: new ErrsoleMongoDB('mongodb://localhost:27017/', 'logs'),
path: '/errsole'
storage: new ErrsoleSequelize({
dialect: 'sqlite',
storage: '/tmp/logs.sqlite'
})
});
const express = require('express');
const app = express();
// Use Errsole proxy middleware
app.use(errsole.proxyMiddleware());
// Register Errsole Proxy Middleware at the desired path (e.g., /errsole)
// Make sure this is the first middleware used
app.use('/errsole', errsole.proxyMiddleware());
app.get('/', function (req, res) {
res.send('Hello World');
// Add other middlewares below the Errsole Proxy Middleware
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
app.listen(3000);
```
#### Key Points to Remember
* **Path is Required:** Provide a path for the middleware where the Errsole Web Dashboard can be accessed.
* **Order of Middleware Matters:** Always place the Errsole Proxy Middleware first in your middleware stack.
Once you have done that, you will be able to access the Errsole Web Dashboard using the same domain as your app. For example:

@@ -80,2 +92,32 @@

#### Note
If you have initialized Errsole with a custom path, you need to append this custom path to the middleware path.
```javascript
const errsole = require('errsole');
const ErrsoleSequelize = require('errsole-sequelize');
const express = require('express');
// Initialize Errsole with a custom path
errsole.initialize({
storage: new ErrsoleSequelize({
dialect: 'sqlite',
storage: '/tmp/logs.sqlite'
}),
path: '/logs/dashboard' // Custom path
});
const app = express();
// Use Errsole Proxy Middleware
app.use('/errsole', errsole.proxyMiddleware());
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
```
In the above example, the Errsole Web Dashboard will be accessible at http://localhost:3000/errsole/logs/dashboard.
## Custom Logging Functions

@@ -87,3 +129,3 @@

**Example:**
#### Example

@@ -102,3 +144,3 @@ ```javascript

**Example:**
#### Example

@@ -113,3 +155,3 @@ ```javascript

**Example:**
#### Example

@@ -124,3 +166,3 @@ ```javascript

**Example:**
#### Example

@@ -135,3 +177,3 @@ ```javascript

**Example:**
#### Example

@@ -138,0 +180,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc