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

express-public-files-overlays

v0.1.3

Published

Serve a set of static files from each URL path, looking in each of a set of directories in turn.

Readme

Express Public Files Overlays

Serves static files from one or more paths in your URL structure. Each URL path can map to one or more directories which will be searched in turn for a file to serve.

Configuration

The components in this package make use of the app.locals.publicFiles namespace. The preparePublicFiles() function helps set up the data structure correctly.

Configuration environment variables for the example.

  • PUBLIC_FILES - JSON-encoded mapping of URL paths to serve static files at, and the directories to look in for each file under that path. e.g. {"/public/js": ["./jquery/", "./react"], "/theme": ["./static"]}

Any configuration from PUBLIC_FILES gets merged into existing configuration such that it is used in preference to it. Effectively, the PUBLIC_FILES settings override settings defined in code.

Additionally:

  • DEBUG - Include express-public-files-overlays to get debug output from the express-public-files-overlays library itself and express-public-files-overlays:server for messages from the example server.

Internal Workings

Internally, the code is designed to work in these stages:

  • publicFilesFromEnv(app) - Parses and returns the config from the PUBLIC_FILES environment variable
  • preparePublicFiles(app, userDirs) - Sets up the publicFiles data structure in app.locals and makes app.locals.publicFiles.overlay() available (see next). userDirs is optional. You usually pass the output of publicFilesFromEnv(app) as the userDirs variable and then use overlay() (see next) to add any public files directoires your library needs to the internal libDirs.
  • app.locals.publicFiles.overlay(urlPath, dirs) - A function other libraries can use to merge any overlays they need into the libDirs configuration. The userDirs configuration will always overlay over the libDirs configuration, even if it is set up earlier.
  • setupPublicFiles(app) - Installs the middleware based on the settings in app.locals.publicFiles. This should always come last.

Example

See the ./example directory.

Dev

npm run fix

Changelog

0.1.3 2019-02-15

  • Removed libDirs from preparePublicFiles(), use overlay() instead.
  • Support YAML as well as JSON in PUBLIC_FILES_DIRS
  • Fixed docs
  • Added warning if dir doesn't exist

0.1.2 2019-02-08

  • Improved Docker example
  • Added path.normalize() to the directories specified in overlay()
  • Improved logging
  • Removed accidentally added JS files. They are released under the licenses described here: https://github.com/thejimmyg/bootstrap-flexbox-overlay/blob/5b85a49741c1521c77fff1bff0b56947fa804854/LICENSE.md and https://github.com/defunkt/jquery-pjax/blob/master/LICENSE

0.1.1 2019-02-07

  • Changed debug behaviour to use own debug(), not app.locals.debug().
  • Moved the example to ./example.

0.1.0 2019-02-06

  • First version