erroremail

0.0.4 • Public • Published

erroremail

Middleware which logs error and sends to email.

Prerequisite

  • Node.js on your platform
  • Setup Gmail for app authorization

Installation

npm install erroremail --save-dev

Example

// Import our library
var erroremail = require('erroremail');

// App get
app.get('/example', (req, res, next)=>{
    try {
        res.json({"Happy Coding!"});
    } catch(err){
        next(err);
    }
});

// Error Handler Middleware
app.use(erroremail('Gmail', 'Your@gmail.com', 'Gmail App Password'));

Single target email address example

app.use(erroremail('Gmail', 'Your@gmail.com', 'Gmail App Password', 'Tomail@gmail.com'));

Multiple emails example

app.use(erroremail('Gmail', 'Your@gmail.com', 'Gmail App Password', ['Tomail@gmail.com', 'Tomail@gmail.com']));

License

MIT

Package Sidebar

Install

npm i erroremail

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

5.58 kB

Total Files

4

Last publish

Collaborators

  • giorgimakh