An open API service indexing awesome lists of open source software.

https://github.com/makerbot/error.flynn

Express middleware for posting errors to Slack
https://github.com/makerbot/error.flynn

nodejs npm-package slack web

Last synced: 5 months ago
JSON representation

Express middleware for posting errors to Slack

Awesome Lists containing this project

README

          

[![Build status](https://travis-ci.org/makerbot/error.flynn.svg?branch=master)](https://travis-ci.org/makerbot/error.flynn)
[![Dependencies](https://david-dm.org/makerbot/error.flynn.svg)](https://david-dm.org/makerbot/error.flynn)

### Install
```sh
npm install --save error.flynn
```

---

### Use
First, setup an Incoming Webhook in Slack `https://.slack.com/services/`

Then:

```js
const express = require('express')
, flynn = require('error.flynn')
, app = express()
;

app.get('/', (req, res, next) => {
next(new Error('Send me to Slack!'));
});
// Either set process.env.ERROR_FLYNN_URL or use the url as the first param for flynn)
app.use(flynn('https://hooks.slack.com/services/TOKEN'));
app.use((err, req, res, next) => {
res.sendStatus(500);
});
```
The last part (below the comment) could also be done more concisely:
```js
app.use(flynn('https://hooks.slack.com/services/TOKEN'), (err, req, res, next) => {
res.sendStatus(500);
});
```

---

### Tests
```sh
npm test
```

---

### Example Output

![Slack message](https://raw.githubusercontent.com/makerbot/error.flynn/gh-pages/example.png)