Protocol Buffer definitions and generated TypeScript code
npm install @molecule-dev/ticketapp-contractsProtocol Buffer definitions and generated TypeScript code .
- proto/ - Protocol Buffer definition files (.proto)
- gen/ - Generated TypeScript files
To generate TypeScript files from the proto definitions, run:
``bash`
protoc \
--proto_path=./proto \
--ts_proto_out=./gen \
--ts_proto_opt=nestJs=true,package=omit \
./proto/*.proto
Make sure you have ts-proto installed globally:
`bash`
npm install -g ts-proto
- --proto_path=./proto - Specifies the directory containing proto files--ts_proto_out=./gen
- - Output directory for generated TypeScript files--ts_proto_opt
- - ts-proto options:nestJs=true
- - Generate NestJS-compatible code with decoratorsaddGrpcMetadata=true
- - Add gRPC metadata parameter to methodsaddNestjsRestParameter=true
- - Add rest parameter for additional argumentsoutputServices=grpc-js
- - Generate service definitions for @grpc/grpc-jsuseExactTypes=false
- - Use simpler type definitions./proto/*.proto
- - Input proto files
The generated code includes:
- AuthServiceController - Interface for your controller implementationAuthServiceControllerMethods()
- - Decorator to apply to your controller classAuthServiceClient
- - Interface for client-side usageAuthServiceService` - gRPC service definition for module configuration
-