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 🙏

© 2026 – Pkg Stats / Ryan Hefner

redhex

v1.0.38

Published

Production grade API builder

Readme

redhex [API Builder]

A Redis(optional), Http/Https and Express API builder

What's New

  • Multiple Redis DB Connection (Starting version 1.0.35 up only)
  • redis field is optional
  • Log CustOm Colors
  • Cors Configuration
  • allowed uploading of file

Example of Multiple redis connection (OPTIONAL)

 redis: { //opitonal
    read: {
      port: 6379,
      host: '127.0.0.1',
      db: 4
    },
    write: {
      port: 6379,
      host: '127.0.0.1',
      db: 5
    }
  }

Then user store like so

const APP = new HEX(manifest)
  APP.Store.read.HGETALL('KEY', callback)
  APP.Store.write.HSET('KEY', ['NAME', 'NICK'], callback)

Example UPLOAD Config (OPTIONAL)

  upload: { 
    folder: '/Users/username/path/to/folder/', //DEFAULTS './uploads'
    publicRoute: '/myroute', // DEFAULT '/uploads'
  }

Then in your request, add the following (important)

in formdata, key should be "filename"
in headers, add "enctype":"multipart/form-data"

then access uploaded files via http://localhost: port/myroute/filename.ext

Example CORS Config

 cors: {
    origin: '*',
    methods: 'GET,PUT,POST,DELETE',
    headers: 'Content-Type,slave',
    maxAge: 5000,
    exposedHeaders: 'slave',
    credentials: false,
  }

and

Example Logger Config

Refer to colorize-log module in npm

  logger: {
    levels: ['start', 'info', 'warn', 'error', 'success', 'data', 'header', 'url'],
    colors: {
      start: 'cyan',
      info: 'gray',
      warn: 'yellow',
      error: 'red',
      success: 'green',
      data: 'magenta',
      header: 'gray',
      url: 'blue',
    },
    consoleColor: 'reset',
    showLevels: true,
    levelsCase: 'uppercase',
    colorizeLevels: false,
    folder: '/Users/username/path/to/folder/'
  }

Installation

--save will save redhex to your dependencies

npm install redhex --save

Manifest [config]

this can be any filename that contains your configurations

{
  ssl:true, //dafault false
  keys:{
    privateKey: PATH.TO.SSL.KEY,
    certificate: PATH.TO.SSL.CERTIFICATE
  },
   cors: {
    origin: '*',
    methods: 'GET,PUT,POST,DELETE',
    headers: 'Content-Type,slave',
    maxAge: 5000,
    exposedHeaders: 'slave',
    credentials: false,
  },
  ports:{
    http:6001,
    https:7001
  },
  api:{
    prefix:ROUTE.PREFIX, //EX: 127.0.0.1:7001/[prexif]/endpoint
  },
  redis:{ // OPTIONAL
    port: 6379,
    host: '127.0.0.1',
    db:4
  },
  logger: {
    levels: ['start', 'info', 'warn', 'error', 'success', 'data', 'header', 'url'],
    colors: {
      start: 'cyan',
      info: 'gray',
      warn: 'yellow',
      error: 'red',
      success: 'green',
      data: 'magenta',
      header: 'gray',
      url: 'blue',
    },
    consoleColor: 'reset',
    showLevels: true,
    levelsCase: 'uppercase',
    colorizeLevels: false,
    folder: '/Users/username/path/to/folder/'
  },
  upload: {  // OPTIONAL
    folder: '/Users/username/path/to/folder/', //DEFAULTS './uploads'
    publicRoute: '/myroute', // DEFAULT '/uploads'
  }
}

Usage

This is how you will use it in its simplest form.

	//ES6
	import HEX FROM 'redhex'
    import manifest from '../path/to/manifest'
    const APP = new HEX(manifest)

    //CommonJS
    var HEX = require('redhex')
    var manifest = require('path/to/manifest')
    //or   
    var manifest = {//same a above manifest example}
    var APP = new HEX(manifest)

Thus

    const APP = new HEX(manifest)
    //Returns Obj = {Route,Log,Store}
APP.Route([array])

Now supports Multipart uploading

    const operatorFunc = function(req,res){}
    const endpoints = [
    					// Normal Route
                        {
                          url:'/user',
                          methods:['POST'],
                          operator: operatorFunc
                        },
                        // File Upload Route [Multipart]
                        {
                          url:'/upload',
                          methods:['POST'],
                          type:'multipart',
                          operator: operatorFunc
                        }
                      ]
    APP.Route(endpoints)
APP.Store (Optional)
	const Store = APP.Store //SHORTEN [optional]
    Store.LPUSH(key, value, callback)

Complete Todo Example

REDHEX-TODO is on Github, Feel free to download it for free. Cheers!

https://github.com/apihive/redhex-todo

Become a contributor

email me at

[email protected]

ISC LICENSE (ISC)

Copyright (c) 2016, Rhomnick B. Coloma [email protected]

Permission to use, copy, modify, and/or distribute this software for any with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.