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

nypr-fastboot

v0.8.0

Published

FastBoot Server for NYPR Apps

Downloads

20

Readme

CircleCI

nypr-fastboot

FastBoot app server preloaded with middlware for NYPR ember apps.

Usage

const fastboot = require('nypr-fastboot');

const server = fastboot({
  bucket: process.env.AWS_BUCKET,
  manifestKey: process.env.FASTBOOT_MANIFEST,
  healthCheckerUA: 'ELB-HealthChecker',
  sentryDSN: process.env.SENTRY_DSN,
  env: process.env.ENV,
  serviceName: process.env.SERVICE_NAME
});

server.start();

FastBoot config options (e.g. gzip, port, chunkedResponse) can be passed in an object under the key fastbootConfig, like so:

const fastboot = require('nypr-fastboot');

const server = fastboot({
  bucket: process.env.AWS_BUCKET,
  manifestKey: process.env.FASTBOOT_MANIFEST,
  healthCheckerUA: 'ELB-HealthChecker',
  sentryDSN: process.env.SENTRY_DSN,
  fastbootConfig: { port: 5000 },
  env: process.env.ENV,
  serviceName: process.env.SERVICE_NAME
})

Included Middleware

health-checker

Bypasses FastBoot if the User-Agent header matches the configured healthCheckerUA value.

preview

Allows to load a particular build of the ember app instead of the currently activated default for the current environment.

Note using this middleware requires that an index file is shipped to s3 using the ember-cli-deploy-s3-index deploy plugin.

Targets a specific build using the v and build query params according to the specifications below:

  • v: loads the the index file located at index.html:<v>.
  • build: the build key is used as a prefix and loads the index file located at <build>/index.html.
  • v and build: combines the above and loads the index file located at <build>/index.html:<v>

If neither are passed, this middleware is a no op and it moves onto the next function in the middleware stack.

Tests

Run the tests with:

$ npm test

Sentry

To configure sentry, create a new project at https://sentry.wnyc.org/sentry/. The creation of that project will automatically generate a DSN. It will look something like this: https://<KEY>@sentry.wnyc.org/<PROJECT_ID>.

In the project that imports this library, make sure to include the sentryDSN parameter when initializing the fastboot server. Best practices around this are to set sentryDSN to an environment variable which can be configured at deployment time.

Statsd

Statsd is a metrics collection and aggregation agent that can plug into a number of backends. We use it to send application metrics to our graphite backend. The collector is installed on the same machine that graphite runs on, and the client responsible for generating and sending metrics is included as a middleware in the lib directory.

The env and serviceName parameters passed into the fastboot constructor are used to namespace the metrics being sent to statsd. Examples of these parameters are env: 'demo' and serviceName: 'wnyc-studios-web-client'. Passing in these parameters will produce a metric with the following name stats.demo.wnyc-studios-web-client.<metric_type>.<metric_name>.