# piston

> A route/path storing and parsing engine

Latest version **0.2.1** (published 2014-01-29) · MIT license · 0 weekly downloads

## Install

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

## 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.2.1 |
| Published | 2014-01-29 |
| First published | 2014-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Scott Corgan |
| Maintainers | scottcorgan |
| Keywords | route, path, engine, store, hash, table |

## Links

- npm: https://www.npmjs.com/package/piston
- Repository: https://github.com/scottcorgan/piston
- Issues: https://github.com/scottcorgan/piston/issues
- npm.io page: https://npm.io/package/piston

## Dependencies (3)

- [drainer](https://npm.io/package/drainer.md) ~0.2.1
- [as-array](https://npm.io/package/as-array.md) ~0.1.1
- [pathetic](https://npm.io/package/pathetic.md) 0.2.x

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.2.1 (latest) — 2014-01-29
- 0.2.0 — 2014-01-29
- 0.1.0 — 2014-01-29

## README

# piston

A route/path storing and parsing engine.

## Install

```
npm install piston --save
```

## Usage 

```js
var Piston = require('piston');
var table = new Piston();

table.register({
  method: 'GET',
  path: '/my-path/:id',
  before: function (req, res, next) {
    // Do something here
    next();
  },
  handler: function (req, res) {
    console.log(req.params.id);
    res.end('you got served!');
  }
});

var route = table.lookup('/my-path/123');
route.params() === {id: 123};

// Run 'before' methods
route.before(req, res, function () {
  // Done
});

// Run 'before' methods and 'handler'
route.handler(req, res);
```

## Run Tests

```
npm install
npm test
```

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