apiwee
basic api key managament
Last updated 4 years ago by chemdrew .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install apiwee 
SYNC missed versions from official npm registry.

A fast and lightweight solution for quickly adding api keys to an Express application

Installation

$ npm install apiwee

the code to put it in

var express = require('express');
var app = express();
var apiweeConfig = {
    username: 'username', // required
    password: 'password', // required
    publicPaths: ['GET:/', 'GET:/health'], // optional
    file: __dirname + '/../myNewFileLocation' // optional, otherwise stored in node_modules/apiwee
}
var apiwee = require('apiwee')(express, app,apiweeConfig);

app.use(apiwee);

app.listen(3000);

how it works

Apiwee is added to the Express middleware functionality, where it validates from a local file (slower than memory but can be updated dynamically).

then navigate to {yourDomain}:{yourPort}/apiwee/admin and login with the credentials provided in the instantiation this will take you to the configurations page where you can define the keys and the routes. You can delete keys, add new ones, edit the key field, drag routes to the api key, and disable keys.

once your api keys are defined use them by using the header field x-api-key

username and password are shown hard-coded in the config but use your best judgement on how to pass them into the instantiation.

handling multiple instances

aws asg group

ensure that each aws instance has permissions for running the aws cli command describe-instances it also requires you to use the tags Environment and Name for the groups

below are the required fields for setting up the api keys on all instances in your aws asg group

var apiweeConfig = {
    username: 'username',
    password: 'password',
    awsRegion: 'us-east-1',
    awsEnvironment: 'development',
    awsInstanceName: 'myApp',
    protocol: 'http/https',
    port: 3000
}
var apiwee = require('apiwee')(express,app,apiweeConfig);

hard-coded ips

below is the required config for scaling your api keys across instances using their addresses Include all ips, including the address it is running on

var apiweeConfig = {
    username: 'username',
    password: 'password',
    ips: ['1.1.1.1', '1.1.1.2', '1.1.1.3'],
    protocol: 'http/https',
    port: 3000
}
var apiwee = require('apiwee')(express,app,apiweeConfig);

screenshots

login configure

Current Tags

  • 0.1.11                                ...           latest (4 years ago)

16 Versions

  • 0.1.11                                ...           4 years ago
  • 0.1.10                                ...           4 years ago
  • 0.1.9                                ...           4 years ago
  • 0.1.8                                ...           4 years ago
  • 0.1.7                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 7
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |