Wint
A collection of high-performance URL routers for JavaScript
Install / Use
/learn @aquapi/WintREADME
Wint
Wint is a collection of high performance, heavily optimized URL routers for building web frameworks and applications.
Wint is compatible for every runtime that does support the Function constructor such as Bun, Node or Deno.
Features
All routers support wildcard and URL parameters matching.
API
Routers have three common methods.
/**
* Add a route handler.
*/
put(method: string, path: string, handler: T): this;
/**
* Find the matching item. Use after calling the `build` function.
*/
find(c: Context): T | null;
/**
* Build the `find` function for the router.
*/
build(): this;
The build function must be called before calling find.
Routers
Currently two routers are supported.
Basic router
This router matches the URL with a radix tree.
The difference between this and other radix tree routers
such as radix3 and @medley/router is that the matcher
is compiled ahead of time, which brings a performance advantage.
import Wint from 'wint-js';
// Create and add routes
const wint = new Wint<() => string>()
.put('GET', '/', () => 'Hi')
.put('POST', '/json', () => '{}')
.put('ALL', '/', () => 'Not found')
.build();
// This is designed to be compatible with the `Request` object
wint.find({
method: 'POST',
path: 'json' // Path should slice the first slash character
}); // () => '{}'
Turbo router
Turbo router matches much faster than basic router but does not support ALL method handler.
import Wint from 'wint-js/turbo';
// Create and add routes
const wint = new Wint<() => string>()
.put('GET', '/', () => 'Hi')
.put('POST', '/json', () => '{}')
.build();
// This is designed to be compatible with the `Request` object
wint.find({
method: 'POST',
url: 'http://localhost:3000/json'
}); // () => '{}'
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
