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

orator-static-server

v2.0.4

Published

Static file serving for Orator API servers.

Readme

Orator Static Server

Static file serving for Orator API servers

Orator Static Server provides static file serving capabilities for Orator. The core static file serving functionality is built directly into the main orator module via the addStaticRoute method, which serves files from disk with MIME type detection and subdomain-based folder routing.

Features

  • File Serving - Serve static files from any directory on disk
  • MIME Detection - Automatic Content-Type headers based on file extension
  • Default Files - Configurable default file (e.g., index.html) for directory requests
  • Route Stripping - Strip URL prefixes before mapping to the filesystem
  • Subdomain Routing - Serve different folders based on request subdomain

Usage

Static file serving is available through the main Orator module's addStaticRoute method:

const libFable = require('fable');
const libOrator = require('orator');
const libOratorServiceServerRestify = require('orator-serviceserver-restify');

const _Fable = new libFable({
	Product: 'MyStaticServer',
	ServicePort: 8080
});

_Fable.serviceManager.addServiceType('Orator', libOrator);
_Fable.serviceManager.addServiceType('OratorServiceServer', libOratorServiceServerRestify);
_Fable.serviceManager.instantiateServiceProvider('Orator');
_Fable.serviceManager.instantiateServiceProvider('OratorServiceServer');

// Serve static files from ./public
_Fable.Orator.addStaticRoute('./public/');

_Fable.Orator.startService();

API

addStaticRoute(pFilePath, pDefaultFile, pRoute, pRouteStrip, pParams)

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | pFilePath | string | required | Path to the directory to serve files from | | pDefaultFile | string | "index.html" | Default file for directory requests | | pRoute | string | "/*" | Route pattern to match | | pRouteStrip | string | "/" | URL prefix to strip before filesystem lookup | | pParams | object | {} | Options passed to serve-static |

Examples

Single Page Application

// All routes fall back to index.html
_Fable.Orator.addStaticRoute('./dist/', 'index.html', '/*');

Serving Under a Subpath

// /app/styles.css serves ./dist/styles.css
_Fable.Orator.addStaticRoute('./dist/', 'index.html', '/app/*', '/app/');

API Server with Static Frontend

// API routes first
_Fable.Orator.serviceServer.get('/api/data',
	(pRequest, pResponse, fNext) =>
	{
		pResponse.send({ value: 42 });
		return fNext();
	});

// Static files for everything else
_Fable.Orator.addStaticRoute('./public/', 'index.html', '/*');

Subdomain Folder Routing

When a request arrives with a subdomain, Orator checks if a matching subfolder exists in the serve directory. If it does, files are served from that subfolder.

For a serve path of ./sites/:

  • http://clienta.example.com/page.html checks for ./sites/clienta/page.html
  • If ./sites/clienta/ exists, it serves from there
  • Otherwise, falls back to ./sites/page.html

Documentation

Full documentation is available in the docs folder, or served locally:

npx docsify-cli serve docs

Related Packages

License

MIT

Contributing

Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.