@ingress/router
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.16 • Public • Published

@ingress/router

The ingress router is an ingress addon that operates in an app driven by the @ingrss/http (or similar) driver. It's purpose is to enable requests to be handled by Controllers (classes) and Routes (methods).

The @ingress/router plugin introduces the @Controller and @Route decorators. @Controller exists on an instance, and facilitates dependency collection of groups of routes, which are declared by @Route decorated class methods.

Example

import { Router, Route } from '@ingress/router'

const router = new Router()
const { Controller } = router

@Controller('/group')
class RouteGroup {
  @Route.Get('/handler')
  handler() {
    return 'Hello World'
  }
}

The above example, declares a route at /group/handler that returns an HTTP 200 OK with a body content of Hello World and a Content-Type of ttext/plain;charset=UTF-8

Alternatively, instead of through decorators, routes can be defined using the API

API

/@ingress/router/

    Package Sidebar

    Install

    npm i @ingress/router

    Weekly Downloads

    84

    Version

    1.0.0-beta.16

    License

    MIT

    Unpacked Size

    113 kB

    Total Files

    42

    Last publish

    Collaborators

    • calebboyd
    • sberan