0.0.17 • Published 5 years ago

evileye v0.0.17

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Evil Eye

An opinionated node.js framework for web backends.

Features

  • GraphQL.
  • Event sourcing.
  • CQRS.
  • Authentication.
  • Logging.
  • Slack alerts.

Get started!

Install it (npm install eviley) and use it:

const evilEye = require('evileye');
evilEye.listen();

Auth

To do authentication, you can pass an auth function to the constructor:

function auth({ user, state }) {
    // This function takes a username (`user`) and should return a secret key that this specific user must know.
    // If the user does not exist, or should not have any access, just throw an error!
    // You can also return a promise and resolve a secret key string, or reject an error.

    if (user === 'alfred') {
        return 'topsecret';
    } else {
        throw new Error('No such user.');
    }
}

const evilEye = new EvilEye({ auth })

If the user passes an Authorization: HTTP header with valid credentials (using the sessionist header), your request object will have an .user property with the authenticated username.

Logging

Example:

evilEye.log.error('Error message', { some: 'metadata' });

Log levels are: error, warn, info, verbose, debug, silly.

Log messages with levels error, warn or info will be sent to Slack. Only use those three for stuff that is important enough to trigger a Slack alert/notification.

Set your Slack web hook URL in this environment variable to enable Slack alerts: SLACK_WEBHOOK_URL

Default Slack alert/notification about process start

Every time the process starts or stops, there will be an alert sent to Slack. It might seem annoying at some times, but it is there to inform you when something crashed, rebooted or hung.

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago