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

find-my-way

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-my-way

Crazy fast http radix based router

  • 8.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
increased by11.38%
Maintainers
2
Weekly downloads
 
Created

What is find-my-way?

The find-my-way npm package is a fast HTTP router for Node.js. It is designed to help developers create routing systems for web applications and APIs. It supports dynamic and static routing, HTTP methods, middleware, hooks, and versioning.

What are find-my-way's main functionalities?

Static Routing

Static routing allows you to define routes for specific paths. When a request matches the path, the associated handler is called.

const findMyWay = require('find-my-way')({ defaultRoute: (req, res) => { res.end('Not Found') } });
findMyWay.on('GET', '/example', (req, res, params) => { res.end('This is a static route example'); });

Dynamic Routing

Dynamic routing supports path parameters, enabling you to capture values from the URL path and pass them to your handler function.

findMyWay.on('GET', '/example/:param', (req, res, params) => { res.end(`Parameter value: ${params.param}`); });

HTTP Methods

The package supports various HTTP methods, allowing you to define different handlers for GET, POST, PUT, DELETE, etc.

findMyWay.on('POST', '/example', (req, res, params) => { res.end('This is a POST method example'); });

Middleware Support

Middleware functions can be used to perform actions before the final handler is executed.

findMyWay.use('/example', (req, res, params, next) => { console.log('Middleware executed'); next(); });

Versioned Routes

Versioning allows you to define different handlers for different versions of your API.

findMyWay.on('GET', '/example', { version: '1.0.0' }, (req, res, params) => { res.end('This is version 1.0.0'); });

Other packages similar to find-my-way

Keywords

FAQs

Package last updated on 17 Sep 2024

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