New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

piston

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piston

A route/path storing and parsing engine

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

piston

A route/path storing and parsing engine.

Install

npm install piston --save

Usage

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

Keywords

route

FAQs

Package last updated on 29 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts