npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chain-reactor/gate

v0.5.1

Published

API Reaction Gateway

Downloads

5

Readme

Reaction Gateway

Simple "just let me develop" API gateway for your enterprise platform with loads of built-in tools everybody needs!

Getting started

npm i reaction-gateway

Creating an app

const gateway = require('reaction-gateway')

This will create a gateway and setup endpoints for healthchecking (fully Kubernetes or other orchistrator compatible).

It will also setup common app defaults and an authorization platform (uses passport, so you'll be able to auth users using user/pass, JWT, Facebook, Google, you name it, you got it). user/pass and JWT are installed by default since everyone uses them.

Passport supports over 500 authorization mechanisms.

Configuration

Reactor is already configured by default, but you can override anything. See the defaults section below for a list of defaults and what you can override.

How to configure your app

Create a /config folder in the root of your project with a file named default.js

default.js contents

module.exports = {
  server: {
    // You can over-ride this if you want to hide which gateway you're running.
    name: 'Reactor',
    // You can over-ride this if you want to as well.
    version: '1.0.0',
    // By default, will try port 8000 and use the next available, override here.
    port: { from: 8000, to: 8999 },
    // You can override the logo as well. Use a string or a script that exports a string.
    logo: require('./inc/logo'),
    // Where the data from services comes from.
    persistence: 'sqllite://root:[email protected]'
  },
  services: {
    defaults: {
      model: {
        freezeTableName: true
      },
      pagination: {
        default: 20,
        max: 1000
      }
    },
    definitions: {
      messages: { model: 'message', auto: true },  
    }
  }
}

Defaults

Configuration is a snap!

Reactor comes with enough defaults so that you can just require it and be up and running.

module.exports = {
  server: {
    port: 3030, // By default, will try port 8000 and use the next available, override here.
    version: '0.1.1', // By default, will use your package.json version, but you can override here.
    logo: require('pathToYourLogoString'), // Default will output fancy "Reactor". Override here.
    persistence: 'mysql://root:Makeitso1@localhost/admin'
  },
  services: {
    defaults: {
      model: {
        freezeTableName: true
      },
      pagination: {
        default: 20,
        max: 1000
      }
    },
    definitions: {
      yourServiecName: {
        model: 'yourModelName',
        auto: true // If true, your service will be auto-generated based on your mode.
        config: {
          // Configuration you pass to your service.
        }
      }
    }
  }
}
`

### Config options

#### server.port
**Default**
{ from: 8000, to: 8999 }

If you specify a number, the server will not start unless that port is free.
If you specify a range using a { from: startingPort, to: endingPort }, the server will find the
first free port within that range.  The port that was chosen will be
available using config.server.port


## Technical details

### Entry point
You start at src/index.js
The logo is drawn, configuration is loaded, and the platform is started.