@node-telescope/express
v0.1.1
Published
Express middleware adapter for Node-Telescope — Laravel Telescope for Node.js
Maintainers
Readme
@node-telescope/express
Express middleware for Node Telescope -- a debugging and monitoring dashboard for Node.js.
Install
npm install @node-telescope/express @node-telescope/storage-sqliteQuick Start
import express from 'express';
import { telescope } from '@node-telescope/express';
const app = express();
app.use(telescope());
app.listen(3000);
// Dashboard: http://localhost:3000/__telescopeZero config. SQLite auto-creates, all watchers enabled, dashboard served at /__telescope.
Configuration
import { telescope } from '@node-telescope/express';
import { EntryType } from '@node-telescope/core';
app.use(telescope({
enabled: true,
path: '/__telescope',
databasePath: './telescope.sqlite',
pruneHours: 24,
ignorePaths: ['/__telescope', '/health'],
gate: (req) => req.headers['x-admin-token'] === 'secret',
hiddenRequestHeaders: ['authorization', 'cookie', 'set-cookie'],
hiddenRequestParameters: ['password', 'token', 'secret'],
watchers: [
{ type: EntryType.Request, enabled: true },
{ type: EntryType.Query, enabled: false },
],
}));Using PostgreSQL or MongoDB
import { telescope } from '@node-telescope/express';
import { PostgresStorage } from '@node-telescope/storage-postgres';
const storage = new PostgresStorage('postgresql://user:pass@localhost:5432/mydb');
await storage.initialize();
app.use(telescope({ storage }));import { MongoStorage } from '@node-telescope/storage-mongodb';
const storage = new MongoStorage('mongodb://localhost:27017', 'telescope');
app.use(telescope({ storage }));Documentation
See the main Node Telescope README for full documentation.
License
MIT
