@nestlab/prefix-controller
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Prefix controller

Prefix controller factory for NestJS.

Install

$ npm i @nestlab/prefix-controller

Examples

Prefix for application space

const AdminController = createPrefixController('admin');
const ConsoleController = createPrefixController('console');

@AdminController('logs')           // Base URL: /admin/logs
export class LogsController {
  // Your implementation
}

@AdminController('users')          // Base URL: /admin/users
export class UserController {
  // Your implementation
}

@ConsoleController('products')     // Base URL: /console/products
export class ProductController {
  // Your implementation
}

Prefix for versioning

const Version1Controller = createPrefixController('v1');
const Version2Controller = createPrefixController('v2');

@Version1Controller('auth')          // Base URL: /v1/auth
export class AuthController {
  // Your implementation
}

@Version2Controller('auth')          // Base URL: /v2/auth
export class AuthController {
  // Your implementation
}

Enjoy!

Package Sidebar

Install

npm i @nestlab/prefix-controller

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

7.95 kB

Total Files

4

Last publish

Collaborators

  • chvarkov