0.1.1 • Published 7 years ago

dingtalk-express-middleware v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

dingtalk-express-middleware

An express error middleware that will send error alert to Dingtalk bot.

Install

$ npm install dingtalk-express-middleware

How to use

All you need is a dingBot url. You should put this middleware before your last error handler.

const dingTalkExpress = require('dingtalk-express-middleware');
app.use(dingTalkExpress({
    name: 'Your app name',
    botUrl: 'Your dingbot url'
}));

Note

  1. If you try catch your err in route handler, you should throw it out
  2. This middleware should put before your last error handler
  3. If your error object has status attribute and it's not 500, it will not send to dingBot

When an error is catched by the middleware you will got an alert.