0.1.0 • Published 7 years ago

@turtlemay/router v0.1.0

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

Installation

npm install @turtlemay/router

Basic Usage

import * as router from '@turtlemay/router'

Define routes and middleware:

// Define routes using regex.
router.use(/^\/$/, (req, res, next) => {
  console.assert(req.path === '/')
  next()
})

Start event listeners and handle the initial route:

router.start()

Request a path:

router.navigate('/foo')

See example for complete usage.