
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
appolo-route
Advanced tools
Fast and simple http routing using radix tree
npm install appolo-route --save
import {Router} from "appolo-route"
let router = new Router()
.get("/test/:param", ()=>"working");
output = router.find("GET" , "/test/test2");
console.log(output.params.param) // test2
console.log(output.handler()) // working
Options
useCache
- cache the find result by path, default : true
maxCacheSize
- The maximum size of the cache routes, default: 1000
decodeUrlParams
- true to decodeURIComponent params value, default: false
let router = new Router()
.get("/test/test2", ()=>"working");
.post("/test/test2", ()=>"working post");
let router = new Router()
.get("/test/:userId/:userName", ()=>"working");
let router = new Router()
.get("/*", ()=>"working");
same syntax as path-to-regexp
let router = new Router()
.get("/test/:file(^\\d+).png", ()=>"working");
find route by path return object with params
and handler
if no params
found return empty object
import {Router} from "appolo-route"
let router = new Router()
.get("/users/:userId", (userId)=>console.log(userId));
result = router.find("GET" , "/users/123");
result.handler(result.params.userId) // 123
register new Route handler using Http.Get Method
register new Route handler using Http.Post Method
register new Route handler using Http.Put Method
register new Route handler using Http.Put Method
register new Route handler using Http.Patch Method
register new Route handler using Http.Delete Method
register new Route handler using Http.Delete Method
register new Route handler. multi methods supported
let router = new Router()
.add(["POST","GET"],"/test/:param", ()=>"working");
remove Route by path. multi methods supported
let router = new Router()
.add(["POST","GET"],"/test/:param", ()=>"working")
.remove("Get","/test/:param");
reset the router remove all routes
MIT
FAQs
fast routing
The npm package appolo-route receives a total of 3 weekly downloads. As such, appolo-route popularity was classified as not popular.
We found that appolo-route demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.