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

apprunner

v0.2.11

Published

Manage application errors and plugin modules by Harald Rudell

Downloads

18

Readme

App Runner

App Runner allows to to generate and maintain many apps using shared code. Require is great, App Runner is greater!

App Runner does three things:

  • Provides loadable apis
  • Manages application errors
  • Emails anomaly reports

Why App Runner? App Runner is App Lego.

If you make many Web apps and you have several of them for example accessing Facebook or using the same type of database, App Runner enables you to architect that in a repeatable pattern. App Runner allows you to use json to configure where code comes from and its settings.

Reference

App Runner handles process exceptions and SIGINT.

  • Exit code 0 is SIGINT
  • Exit code 2 is unhandled exception

initApp(defaults, app, cb)

  • defaults: options, typically loaded by haraldops

    • .init.appFolder: string: the folder of initial script
    • .init.logger: optional function(string): logging, default console.log
    • .init.ops.sendMail: optional function(subject, body): Sends mail, default none
    • .api: optional, indicates that Api Manager should be used
    • .api.apiMap: api configurations
  • app: Web server, has .on and .get methods

  • cb(err): optional function

getApi(opts, cb)

get an api implementation

  • opts: object
  • .api: string: name of api function to be loaded
  • cb(err, module)

APIs are either configured directly in opts, or in defaults provided at App Runner init

If module has module.emitter, APp Runner will listen and manage error events

anomaly(...)

Report any argument as an anomaly, to the log and if so configured a periodcal email.

enableAnomalyMail(flag)

control emailing on or off: flag: boolean, default: false

getCbCounter()

Ensures that all callbacks has completed

var haraldutil = require('haraldutil')
var cbc = haraldutil.getCbCounter()
setTimeout(cbc.add(callback), 100)
setTimeout(cbc.add(callback), 100)

function callback() {
  if (cbc.isDone(arguments.callee))
    console.log('All callbacks completed.')
  else console.log('Not done yet...')
}
Not done yet...
All callbacks completed.

var cbc = getCbCounter(opts)

  • opts: optional object

  • opts.emitter: optional event emitter or boolean. default: errors are thrown

    • false: errors are ignored
    • emitter: errors are emitted
  • opts.callback: function or array of function: add is done for each function

cbc: object

  • .add(f): adds a callback for function f, return value: f
  • .isDone(f): notes one callback completed. returns true if all callbacks complete, otherwise false
  • .getStatus(): gets an object representing the current state

Examples

TODO

Notes

(c) Harald Rudell wrote this for node in September, 2012

No warranty expressed or implied. Use at your own risk.

Please suggest better ways, new features, and possible difficulties on github