# stackr

> A simple http module system for node.js applications.

Latest version **0.1.1** (published 2014-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install stackr
pnpm add stackr
yarn add stackr
bun add stackr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-01-21 |
| First published | 2014-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Matt Dunlap |
| Maintainers | prestaul |

## Links

- npm: https://www.npmjs.com/package/stackr
- Repository: git@github.com:Prestaul/stackr
- npm.io page: https://npm.io/package/stackr

## Recent versions

- 0.1.1 (latest) — 2014-01-21
- 0.1.0 — 2014-01-17

## README

stackr
======

A simple http module system for node.js applications, similar to [*connect*](https://github.com/senchalabs/connect), or the more basic [*stack*](https://github.com/creationix/stack).

Stackr does not supply any middleware, it just provides an easy interface for composing a middleware stack.


Basic Usage
-----------
Stackr can be required like any other node module:
```js
var stackr = require('stackr');
```

You can construct a stack by passing middleware to the `stackr` constructor as arguments:
```js
var stack = stackr(
    require('logger')(),
    require('static')(root, mount)
);
```

 or by calling `use` on the stack:
```js
var stack = stackr()
    .use(require('logger')())
    .use(require('static')(root, mount));
```


Creating a Server
-----------------
Your stack can be used to create an http server:
```js
require('http').createServer(stackr(
    require('logger')(),
    require('static')(root, mount)
)).listen(1337);
```


Using Substacks
---------------
Substacks provide a simple way to compose more complex stacks:
```js
var substack = stackr.substack(
    require('logger')()
);

var stack = stackr(
    substack,
    require('auth')()
);

substack.use(require('static')(root, mount));
```

In the above example the execution order will be `logger`, `static`, then `auth` because the entire substack will execute before anything that follows it in the outer stack.

---
_Source: https://npm.io/package/stackr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
