diogenes-lantern

6.0.2 • Public • Published

diogenes-lantern

This package visualise the dependency graph of a diogenes registry. It helps understanding the code in a visual way.

graph

How to use it

The idea is to import it as express middleware:

const express = require('express');
const lanternMiddleware = require('diogenes-lantern');

const app = express();

app.get('/', lanternMiddleware(getRegistry, { title: 'test' }))
app.listen(3000, () => console.log('Listening at: http://localhost:3000'))

The middleware takes a function that returns a diogenes registry. This function takes req and res as argument so it is able to extract a registry from there if necessary.

When hitting the endpoint you get a representation of the dependency graph. You can inspect every node and get helpful info such as documentation, file and line number etc. Here's an example implementation of getRegistry:

const getRegistry = (req, res) => registry.clone().addDeps({ req, res })

The "clone" ensure I am not changing the original registry.

graph2

Package Sidebar

Install

npm i diogenes-lantern

Weekly Downloads

10

Version

6.0.2

License

MIT

Unpacked Size

1.7 MB

Total Files

17

Last publish

Collaborators

  • sithmel