0.3.0 • Published 7 years ago

routeplus v0.3.0

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

routeplus

NPM version

Express Route++

Installation

$ yarn add routeplus

Named Routes

Name your routes and reference to them anywhere within your app.

Route plus provides a plug in-out interface.

// using named routes

const express = require('express')
const rp = require('routeplus')

let app = express()

// Create a new router
let router = rp.router(express.Router(), {
  prefix: '/user'
})

// Define Routes as usual + fluent api
router.match(['GET'], '/settings', handler).as('setting')

router.get('/dasboard', handler).as('dashboard')

router.get('/p/:username', handler).as('profile')

app.use('/user', router.mount())

Generate urls from route names anywhere in app

rp.url('dashboard') // outputs "/user/dashboard"

rp.url('profile', {username: 'johndoe'}); // outputs  /user/p/morrelinko

API

routeplus.router()

routeplus.url()

routeplus.routeTable()

routeplus.clear()

Testing

Clone the repository from github and run the commands below

$ yarn install 
$ yarn test

Contribution

View list of all contributors Here

0.3.0

7 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago