Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Modules

ghostsnstuff edited this page · 11 revisions
Clone this wiki locally

This is a list of small production ready modules that do one thing well for web servers.

Modules

Routers

routes

routes is the express.js router broken out into a standalone module. You can add route handlers and you can match an url on the router to get the right route handler

routes-router

routes-router uses routes but creates a function handler(req, res) {} function that you can plug into your http server. It handles error handling (optionally with domains) & 404's for you by default. This is for convenience. It's recommended you read the source code and write your own server request handler in your application.

mapleTree

An alternative router that is tree based and might be more efficient. It's also more flexible in how it finds the correct route handler for any given url.

http-methods

http-methods is like a router but instead of routing on req.url it routes on the req.method. You can easily create a single route handler that dispatches to different functions based on method.

egress

A "pragmatic router," egress is uniquely designed for tree-like routing tables. It can be used on its own or as Connect middleware.

Request modules

body

A set of asynchronous functions that parses the body of out of a req. It can also parse form encoded & json encoded bodies. body will limit the amount of body parsing to 1MB by default to prevent buffer overflows.

raw-body

raw-body will parse the body of a readable stream as a Buffer. It has a limiting mechanism to limit the size of the body to prevent buffer overflows.

cookies and keygrip

Read the cookies out of a req. Also has functionality to set cookies on the res. Use cookies with keygrip for signing cookies using rotated credentials.

Response modules

send-data

Send different types of resources to the client, like json or error or html. This module will set the headers properly on your behalf.

redirecter

Sends a proper HTTP redirect response to a res.

serve-favicon

Favicon serving middleware.

serve-file-download

Sets appropriate content-disposition header and pipes data to res.

Route handlers

st

st is a static file handler. It's efficient and handles cache headers properly.

serve-browserify

serve-browserify is like a static file handler for javascript files but will browserify those files transparently on the fly. Optionally handles caching & gzipping.

npm-less

npm-less is like a static file handler for css files but will compile LESS files transparently on the fly. Optionally handles caching & gzipping.

filed

filed is a streaming file handler. This allows you to serve streaming files with the correct HTTP headers without caching the files in memory.

request

request allows you to make HTTP client requests to other servers. You can use request in your web server to forward a HTTP response from a 3rd party server to your res

Templates

hyperscript

hyperscript is an easy way to create templates in javascript. This allows you to use require for template inheritance and functions for template re-use. It's the simplest templating system that works as it's pure javascript.

consolidate.js

consolidate is a large wrapper around many popular templating languages that exposes the same API for each templating language.

Validators

validate-form

validate-form is a validation library that you can use to define a schema (a function) to validate arbitrary objects. validate-form is recursively made up of small functions so its really easy to add new validation logic.

joi

joi is another validation library. It allows you to define complex schemas using a chaining syntax.

Sessions

redsess

redsess is a redis backed session library. It creates an asynchronous session interface based upon a req/res pair. It will handle managing your session id & cookies for you.

level-session

level-session is a levelDB backed session library. It creates an asynchronous session interface based upon a req/res pair. It will handle managing your session id & cookies for you.

generic-session

generic-session is like redsess & level-session but has a MemoryStore interface for storing sessions in memory. This is great for tests.

pwd

pwd is a module for hashing a password. The first hash will generate a salt for it. You can then verify the password a second time with the salt to check hashes. This is great for a /login & /signup flow.

Modules

config-chain

config-chain makes it easy to load configuration from anywhere. This is a great way of setting up a cascading config system for your production web server.

error

error makes it easy to create re-usable errors that contain meta information about what went wrong.

Something went wrong with that request. Please try again.