@vyriy/router

Small typed router for HTTP handlers and application entrypoints.

Purpose

Use this package when a Vyriy project needs a small focused module for router behavior.

Vyriy packages are intentionally small. The goal is to keep the public API explicit, easy to test, and easy to compose with the rest of the Vyriy ecosystem.

Install

With npm:

npm install @vyriy/router

With Yarn:

yarn add @vyriy/router

Usage

import { createRouter } from '@vyriy/router';

const router = createRouter()
  .get('/health', async () => ({ statusCode: 200, body: 'ok' }))
  .post('/items', async (request) => ({ statusCode: 201, body: request.body }));

export const handler = router.handler();

Public API

The package is expected to expose the following main surface:

  • createRouter
  • router
  • route
  • get
  • post
  • put
  • patch
  • del
  • notFound

Parameters and options

  • method — HTTP method matched by the route.
  • path — Route path or matcher.
  • handler — Function called for a matching request.
  • fallback — Handler used when no route matches.

Examples

Minimal usage

import * as module from '@vyriy/router';

console.info(module);

Use inside a Vyriy package

// packages/example/index.ts
export { default as example } from '@vyriy/router';

Keep the boundary explicit

// Prefer importing from the package root unless a documented subpath is required.
import {} from /* named export */ '@vyriy/router';

Notes

  • Keep configuration close to the package that owns it.
  • Prefer explicit options over hidden global state.
  • Keep examples small enough to copy into tests or Storybook docs.
  • When adding a new public export, document it in this README and add a focused test.

Related packages

  • @vyriy/config for environment-driven options.
  • @vyriy/script for readable operational flows.
  • @vyriy/handler and @vyriy/server when the package participates in runtime handling.