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 🙏

© 2025 – Pkg Stats / Ryan Hefner

whook

v3.1.3

Published

Build strong and efficient REST web services.

Downloads

33

Readme

whook

Build strong and efficient REST web services.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate Dependency Status Package Quality

whook

Build strong and efficient REST web services.

whook allows you to create REST web services by providing its ingredients and the recipe to make it work altogether.

The recipe is your Open API definition while ingredients are handlers, services and their configuration.

Principles

Whook work by adding ingredients to you API:

  • configuration: Whokk look ups for config/{NODE_ENV}/config.js files. It creates constants you can inject in your handlers and services.
  • API: It defines the various endpoint of you API and how to map these to handlers thanks to the well known OpenAPI format (formerly Swagger),
  • handlers: the code that implement those endpoints,
  • services: various services that deal with global states,
  • wrappers: higher order functions you can apply to handlers (CORS, authentication...).

Whook is built over Knifecyle which is great for adding or easily override/wrap a lot of its core component. It brings instrumentation and testability to your code bases.

Whook also rely on swagger-http-router which is a the heart of its routing system.

Work in progress

I'd like to end up with a quick start guide looking like that:

# Initialize the project
mkdir simple_server && cd simple_server;
npm init whook simple_server;
npm install;

# Check install with a dry run of the server
DRY_RUN=1 npm run start

But atm, I only need it for my projects so leaving this as is in the meanwhile. If you're still motivated to use it, you should take a look to this project's architecture notes.

API

Functions

runServer(injectedNames, $) ⇒

Runs the Whook server

Kind: global function
Returns: Object A promise of the injected services

| Param | Type | Description | | --- | --- | --- | | injectedNames | Array.<String> | Root dependencies names to instanciate and return | | $ | Knifecycle | The Knifecycle instance to use for the server run |

prepareServer($) ⇒

Kind: global function
Returns: Promise A promise of the Knifecycle instance

| Param | Type | Description | | --- | --- | --- | | $ | Knifecycle | The Knifecycle instance to set the various services |

initENV(services, [log]) ⇒ Promise.<Object>

Initialize the ENV service using process env plus dotenv files

Kind: global function
Returns: Promise.<Object> - A promise of an object containing the actual env vars.

| Param | Type | Default | Description | | --- | --- | --- | --- | | services | Object | | The services ENV depends on | | services.NODE_ENV | Object | | The injected NODE_ENV value to lookk for .env.${NODE_ENV} env file | | services.PWD | Object | | The process current working directory | | [services.BASE_ENV] | Object | {} | An optional base environment | | [log] | Object | noop | An optional logging service |

initHOST(services, [log]) ⇒ Promise.<String>

Initialize the HOST service from ENV or auto-detection if none specified in ENV

Kind: global function
Returns: Promise.<String> - A promise of a containing the actual host.

| Param | Type | Default | Description | | --- | --- | --- | --- | | services | Object | | The services HOST depends on | | [services.ENV] | Object | {} | An optional environment object | | [log] | Object | noop | An optional logging service |

initPORT(services, [log]) ⇒ Promise.<Number>

Initialize the PORT service from ENV or auto-detection if none specified in ENV

Kind: global function
Returns: Promise.<Number> - A promise of a number representing the actual port.

| Param | Type | Default | Description | | --- | --- | --- | --- | | services | Object | | The services PORT depends on | | [services.ENV] | Object | {} | An optional environment object | | [log] | Object | noop | An optional logging service |

Authors

License

MIT