Meeshkan express middleware
Express server middleware to log requests and responses in http-types format.
Usage
Add this middleware before adding routes, otherwise it won't work.
const mw, { LocalFileSystemTransport } = require("@meeshkan/express-middleware");
const customTransport = async httpExchange => {
console.log("Got http exchange", httpExchange);
};
app.use(
middleware({
transports: [LocalFileSystemTransport("http-exchanges.jsonl"), customTransport],
})
);
Development
Install dependencies:
$ yarn
Run tests:
$ yarn test
Compile TypeScript:
$ yarn compile
Publish package:
$ yarn publish --access public
Push git tags:
$ TAG=v`cat package.json | grep version | awk 'BEGIN { FS = "\"" } { print $4 }'`
$ git tag -a $TAG -m $TAG
$ git push origin $TAG