Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bleckert/router

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bleckert/router

Simple router

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Router

<0.5kb minified and gzipped

Install

Download dist/module.js or install with npm (npm install @bleckert/router).

Usage

Simply create a new router like this:

const router = new Router();

You can also create the router with a base url (will be prepended on all routes) and/or a routes object.

const router = new Router('/user', {
	profile(route, path) {

	},
	settings(route, path) {

	}
});

You can also add routes after init and call dispatch manually. This is how you add routes:

router.on('/profile', (route, path, event) => {

});

router.on('/splat/*', (route, path, event) => {

});

router.on('/named/:id', (route, path, event) => {

});

router.dispatch();

Keywords

FAQs

Package last updated on 14 Jun 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc