Expressive is a developer tool that tracks and visualizes server routes in Express applications. Useful for debugging and teaching alike, Expressive enables developers to send client requests to their Express server, and then render a dynamic and comprehensive visualization of server state throughout the lifespan of each request -- all from the command line.
$ npm install expressivejs --save-dev
Replace all instances of require('express')
with require('expressivejs')
. This will enable Expressive to progressively document the state of client requests and server responses.
This file should be called expressive.config.js and be located in your application's root directory.
TBD
TBD
$ xpr-test
: Test your server routes. Sends http requests to your Express server as specified in your expressive.config.js file. This will create an expressive.json file in which information on request and response states is stored. If the file already exists from previous tests, it will be overwritten.
$ xpr-build
: Bundle data from the expressive.json file created using the xpr-test command for use in rendering a visualization of your server routes.
$ xpr-display
: Render a visualization of your server routes based on the data bundled from the xpr-test command.
$ xpr
: Test your server routes, then bundle the collected data, and then render a visualization. Equivalent to running xpr-test followed by xpr-build followed by xpr-display.
Any server middleware that alters res.locals._XPR will interfere with Expressive's functionality. Expressive tracks the state of client requests and server responses by storing information at the _XPR key within the locals property of the server response body.
When relocating your Expressive configuration file, be sure to alter its relative path to your server file accordingly.
Before running your application for non-testing purposes, be sure to change all instances of require('expressivejs')
in your server files back to require('express')
.
Follow our GitHub repo for updates.
Glenn Alexander | Ryan Fowlkes Smith | Kangseon Cho | Mary Snow