@turtlemay/router
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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.

Package Sidebar

Install

npm i @turtlemay/router

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • turtlemay