Skip to content

darioielardi/nestjs-rpc

Repository files navigation

NestJS RPC

Installation

npm install nestjs-rpc

Usage

import { RpcController, RpcMethod } from 'nestjs-rpc';

@RpcController('users')
class UsersController {
  @RpcMethod()
  find() {}

  @RpcMethod()
  create() {}
}

The example above gives us the following endpoints:

  • POST users/find
  • POST users/create

Swagger

If you are using the @nestjs/swagger package to generate OpenAPI specs the RPC methods will automatically have the ApiOperation decorator set with the operationId attribute set as the method name, and the controller class will have the ApiTags decorator with the base path as the tag.

You can also provide all the ApiOperation options to the RpcMethod decorator, except for the operationId attribute which will be set as the method name unless specified with the name attribute.

Contributing

Contributions welcome! See Contributing.

License

Licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published