You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@ingress/router

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ingress/router

A fast router middleware for ingress

1.0.0-beta.16
latest
npmnpm
Version published
Maintainers
2
Created
Source

@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

Keywords

radix

FAQs

Package last updated on 23 Apr 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.