Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

froute

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

froute

Simple and powerful routing for node with expressive matching

latest
npmnpm
Version
0.0.15
Version published
Maintainers
1
Created
Source

froute Build Status npm version Dependency Status

Simple and powerful routing for node with expressive matching.

froute

Getting started

npm install froute --save
var froute = require("froute");

Examples

Binding a froute template

var template = "/apple/{type}",
    bindResult = froute.bind(template, callback);

expect(bindResult).toBeTruthy();
expect(froute.list().length).toEqual(1);

Unbinding a froute template

var unbound = froute.unbind(template);

expect(unbound.length).toEqual(1);

Full example, bind and dispatch

var template = "/apple/{type}/size/{size}",
    resultParams;

var bindResult = froute.bind(template, function(params) {
    resultParams = params;
});

var dispatchResult = froute.dispatch("/apple/gala/size/large");

expect(bindResult).toBeTruthy();
expect(dispatchResult).toBeTruthy();
expect(froute.list().length).toEqual(1);
expect(resultParams).toEqual({type:"gala",size:"large"});

Keywords

froute

FAQs

Package last updated on 09 Feb 2015

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