New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@back2wild/koa-class-router

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@back2wild/koa-class-router

> A typescript class decorator based router for koajs

0.0.2
latest
Source
npm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

@back2wild/koa-class-router

A typescript class decorator based router for koajs

Example

import { Routes, Route, KCRRoutes } from '@back2wild/koa-class-router';

@Routes()
class User extends KCRRoutes {
  @Route({
    method: 'POST',
  })
  public async login(ctx: Koa.Context) {
    ctx.response.body = {
      message: 'OK'
    };
    ctx.response.type = 'application/json';
  }
}

const userRoutes = new User();
userRoutes.routes.forEach((r) => {
  app.use(r);
});

Now, the request POST /User/login will be route to method User.login.

FAQs

Package last updated on 10 Apr 2021

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