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

slower

v2.2.0

Published

A package for simple HTTP server routing.

Readme

Slower

A minimal, dependency-free HTTP framework for Node.js.
Slower provides a small subset of Express.js–style routing and middleware with a simpler internal model.

Don't want to download 200 megabytes of modules from Express? Then try Slower 😉.

It's just a couple files and a few KB.

This might not be the most robust library, but it is small and lightweight, and it does the job. (Just don't use this in production, please.)


A word about this:

Sorry for the (really) poorly written documentation, I need time to re-write it. If you would like to help, just email me (email on package.json), and I will be more than happy to talk to you.


Features

  • No external dependencies
  • Express-like API and functionality (get, post, use, all, etc.)
  • Static file serving
  • Sub-routers and route grouping
  • SMALL!

Installation

npm install slower

(Or just download this source code and put on a 'lib/slower' folder, it's what I usually do).


Basic Usage

Check examples/ for some samples on how to use this library.

The basic is: if works on Express, probably works here too (apart from some minor modifications, there is very little difference in the two public APIs)

const slower = require('slower');

const app = slower();

app.get('/', (req, res) => {
    res.send('Hello world');
});

app.listen(3000);

Template URLs:

The same basic rules that express.js applied are available here, since JS internalized the URLPattern API, and this library uses the pattern matching from URLPattern.

If you have questions, check this guide on URLPattern: https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API#pattern_syntax

Routing

HTTP Methods

All standard HTTP verbs are supported:

app.get('/users', handler);
app.post('/users', handler);
app.put('/users/:id', handler);
app.delete('/users/:id', handler);

Route Parameters

Routes use URLPattern internally and support named parameters:

app.get('/users/:id', (req, res) => {
    res.json({ id: req.params.id });
});

Multiple Handlers / Middleware

Handlers are executed sequentially and receive next():

app.get('/secure', authMiddleware, (req, res) => {
    res.send('Authorized');
});

Middleware

use() Attach middleware for all HTTP methods:

app.use((req, res, next) => {
    console.log(req.method, req.url);
    next();
});

all()

Apply handlers to specific paths or methods:

app.all('/health', (req, res) => {
    res.send('OK');
});

Request Object (req)

  • req.params – route parameters
  • req.query – parsed query string
  • req.body
  • buffer
  • text()
  • json()
  • req.ip – remote IP address
  • req.session
  • host
  • port
  • rhost - remote connected host
  • rport - remote connected port

Example:

app.post('/data', async (req, res) => {
    const body = req.body.json();
    res.json(body);
});

Response Object (res)

  • res.status(code)
  • res.set(name, value)
  • res.get(name)
  • res.type(mimeOrExtension)
  • res.send(body)
  • res.json(object)
  • res.file(path)
  • res.render(templatePath, data)
  • res.redirect(path)

Example:

res.status(201).json({ success: true });

Static Files

Serve a directory of static files:

app.static('public');

Or mount it at a specific path:

app.static('public', '/assets');

HTML files are also served without the .html extension automatically.

Routers

Sub-Router

const router = slower.Router();

router.get('/users', handler);
router.post('/users', handler);

app.useRouter(router, '/api');

Route Groups

app.route('/users').get(listUsers).post(createUser);

HTTPS Support

Pass options directly to the underlying server:

const fs = require('fs');

const app = slower({
    https: true,
    key: fs.readFileSync('key.pem'),
    cert: fs.readFileSync('cert.pem'),
});

Fallback page

If no route matches, it returns a default 404 HTML response:

Cannot {METHOD} /{path}

Custom fallback behavior can be implemented using middleware.

Method documentation

Main Export

slower(options?: object) : <SlowerRouter>

Creates a new Slower application instance.

  • options are forwarded to http.createServer or https.createServer
  • If options.https === true, HTTPS is used

Class: <SlowerRouter>

Main application router and HTTP server wrapper.

Server Control

Start the HTTP/HTTPS server:

<SlowerRouter>.listen(...args) : http.Server

Stops the server:

<SlowerRouter>.close(callback?: function) : void

Routing Methods

The following methods share the same signature:

<SlowerRouter>.get(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.post(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.put(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.delete(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.patch(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.options(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.head(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.trace(path, ...handlers) : <SlowerRouter>

<SlowerRouter>.connect(path, ...handlers) : <SlowerRouter>
  • path may be a string, RegExp, or middleware function
  • Handlers are called sequentially with (req, res, next)

Middleware

<SlowerRouter>.use(...handlers: function\[\]) : <SlowerRouter>

Registers global middleware for all HTTP methods.

<SlowerRouter>.all(pathOrMethod, ...handlers) : <SlowerRouter>

Registers handlers across multiple HTTP methods depending on the first argument.

Static Files

<SlowerRouter>.static(directoryPath: string, mountPath?: string) : <SlowerRouter>

Serves static files from a directory.

Routers

<SlowerRouter>.useRouter(router: <SlowerSubRouter>, mountPath?: string) : <SlowerRouter>

Mounts a sub-router at the specified path.

<SlowerRouter>.route(path: string | RegExp) : <SlowerSubRouter>

Creates a route group bound to a single path.

Class: <\SlowerSubRouter>

Router container used for grouping routes before mounting.

<SlowerSubRouter>.get(path, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.post(path, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.put(path, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.delete(path, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.patch(path, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.use(...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.all(pathOrMethod, ...handlers) : <SlowerSubRouter>

<SlowerSubRouter>.static(directoryPath, mountPath?) : <SlowerSubRouter>

<SlowerSubRouter>.route(path) : <SlowerMicroRouter>

Request Extensions

req.get(headerName: string) : string | undefined

req.body.buffer : Buffer

req.body.text() : string

req.body.json() : any

req.query : object

req.params : object | undefined

req.ip : string

req.session : object

Response Extensions

res.status(code: number) : res

res.set(name: string | object, value?: string) : res

res.get(name: string) : string | undefined

res.type(type: string) : res

res.send(body: string | Buffer) : void

res.json(data: any) : void

res.file(path: string) : void

res.render(templatePath: string, data?: object) : void

res.redirect(path: string) : void

License: MIT

License

This is MIT-licensed. Just use it.