From 3ec5be0dd3e62e7ba4b2ffacea9eafe8dfe8c1e6 Mon Sep 17 00:00:00 2001 From: YoungKi Lyu Date: Mon, 18 Mar 2024 22:38:48 +0900 Subject: [PATCH] sample(04-grpc): Merge independent gRPC Client / Server example --- sample/{34-grpc-client-server => 04-grpc}/README.md | 6 +++--- sample/04-grpc/{ => client}/.eslintrc.js | 0 sample/04-grpc/{ => client}/.gitignore | 0 sample/04-grpc/{ => client}/nest-cli.json | 0 .../client/package-lock.json | 0 .../{34-grpc-client-server => 04-grpc}/client/package.json | 0 .../client/src/app.module.ts | 0 .../client/src/helloworld/helloworld.controller.ts | 0 .../client/src/helloworld/helloworld.module.ts | 0 .../client/src/hero/hero.controller.ts | 0 .../client/src/hero/hero.module.ts | 0 .../client/src/interface/helloworld.ts | 0 .../client/src/interface/hero.ts | 0 .../{34-grpc-client-server => 04-grpc}/client/src/main.ts | 0 sample/04-grpc/{ => client}/tsconfig.build.json | 0 .../{34-grpc-client-server => 04-grpc}/client/tsconfig.json | 0 .../client => 04-grpc/hybrid}/.eslintrc.js | 0 .../client => 04-grpc/hybrid}/.gitignore | 0 .../client => 04-grpc/hybrid}/nest-cli.json | 0 sample/04-grpc/{ => hybrid}/package-lock.json | 0 sample/04-grpc/{ => hybrid}/package.json | 0 sample/04-grpc/{ => hybrid}/src/app.module.ts | 0 sample/04-grpc/{ => hybrid}/src/grpc-client.options.ts | 0 sample/04-grpc/{ => hybrid}/src/hero/hero.controller.ts | 0 sample/04-grpc/{ => hybrid}/src/hero/hero.module.ts | 0 sample/04-grpc/{ => hybrid}/src/hero/hero.proto | 0 .../src/hero/interfaces/hero-by-id.interface.ts | 0 .../{ => hybrid}/src/hero/interfaces/hero.interface.ts | 0 sample/04-grpc/{ => hybrid}/src/main.ts | 0 .../client => 04-grpc/hybrid}/tsconfig.build.json | 0 sample/04-grpc/{ => hybrid}/tsconfig.json | 0 .../proto/helloworld.proto | 0 sample/{34-grpc-client-server => 04-grpc}/proto/hero.proto | 0 .../{34-grpc-client-server => 04-grpc}/server/.eslintrc.js | 0 sample/{34-grpc-client-server => 04-grpc}/server/.gitignore | 0 .../{34-grpc-client-server => 04-grpc}/server/nest-cli.json | 0 .../server/package-lock.json | 0 .../{34-grpc-client-server => 04-grpc}/server/package.json | 0 .../server/src/app.module.ts | 0 .../server/src/helloworld/helloworld.controller.ts | 0 .../server/src/helloworld/helloworld.module.ts | 0 .../server/src/hero/hero.controller.ts | 0 .../server/src/hero/hero.module.ts | 0 .../server/src/interface/helloworld.ts | 0 .../server/src/interface/hero.ts | 0 .../{34-grpc-client-server => 04-grpc}/server/src/main.ts | 0 .../server/tsconfig.build.json | 0 .../{34-grpc-client-server => 04-grpc}/server/tsconfig.json | 0 48 files changed, 3 insertions(+), 3 deletions(-) rename sample/{34-grpc-client-server => 04-grpc}/README.md (85%) rename sample/04-grpc/{ => client}/.eslintrc.js (100%) rename sample/04-grpc/{ => client}/.gitignore (100%) rename sample/04-grpc/{ => client}/nest-cli.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/package-lock.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/package.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/app.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/helloworld/helloworld.controller.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/helloworld/helloworld.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/hero/hero.controller.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/hero/hero.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/interface/helloworld.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/interface/hero.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/src/main.ts (100%) rename sample/04-grpc/{ => client}/tsconfig.build.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/client/tsconfig.json (100%) rename sample/{34-grpc-client-server/client => 04-grpc/hybrid}/.eslintrc.js (100%) rename sample/{34-grpc-client-server/client => 04-grpc/hybrid}/.gitignore (100%) rename sample/{34-grpc-client-server/client => 04-grpc/hybrid}/nest-cli.json (100%) rename sample/04-grpc/{ => hybrid}/package-lock.json (100%) rename sample/04-grpc/{ => hybrid}/package.json (100%) rename sample/04-grpc/{ => hybrid}/src/app.module.ts (100%) rename sample/04-grpc/{ => hybrid}/src/grpc-client.options.ts (100%) rename sample/04-grpc/{ => hybrid}/src/hero/hero.controller.ts (100%) rename sample/04-grpc/{ => hybrid}/src/hero/hero.module.ts (100%) rename sample/04-grpc/{ => hybrid}/src/hero/hero.proto (100%) rename sample/04-grpc/{ => hybrid}/src/hero/interfaces/hero-by-id.interface.ts (100%) rename sample/04-grpc/{ => hybrid}/src/hero/interfaces/hero.interface.ts (100%) rename sample/04-grpc/{ => hybrid}/src/main.ts (100%) rename sample/{34-grpc-client-server/client => 04-grpc/hybrid}/tsconfig.build.json (100%) rename sample/04-grpc/{ => hybrid}/tsconfig.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/proto/helloworld.proto (100%) rename sample/{34-grpc-client-server => 04-grpc}/proto/hero.proto (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/.eslintrc.js (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/.gitignore (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/nest-cli.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/package-lock.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/package.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/app.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/helloworld/helloworld.controller.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/helloworld/helloworld.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/hero/hero.controller.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/hero/hero.module.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/interface/helloworld.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/interface/hero.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/src/main.ts (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/tsconfig.build.json (100%) rename sample/{34-grpc-client-server => 04-grpc}/server/tsconfig.json (100%) diff --git a/sample/34-grpc-client-server/README.md b/sample/04-grpc/README.md similarity index 85% rename from sample/34-grpc-client-server/README.md rename to sample/04-grpc/README.md index 8196ea34484..eb539f5005d 100644 --- a/sample/34-grpc-client-server/README.md +++ b/sample/04-grpc/README.md @@ -1,8 +1,8 @@ # gRPC - Client / Server -[nest/sample/04-grpc/](https://github.com/nestjs/nest/tree/master/sample/04-grpc) is a hybrid application (HTTP + gRPC), where the gRPC client and gRPC server are written together as one program. +[nest/sample/04-grpc/hybrid/](https://github.com/nestjs/nest/tree/master/sample/04-grpc/hybrid/) is a hybrid application (HTTP + gRPC), where the gRPC client and gRPC server are written together as one program. -nest/sample/34-grpc-client-server/ uses the [ts-proto](https://www.npmjs.com/package/ts-proto) package to convert proto files to TypeScript(NestJS).
+[nest/sample/04-grpc/client/](https://github.com/nestjs/nest/tree/master/sample/04-grpc/client/) & [nest/sample/04-grpc/server/](https://github.com/nestjs/nest/tree/master/sample/04-grpc/server/) use the [ts-proto](https://www.npmjs.com/package/ts-proto) package to convert proto files to TypeScript(NestJS).
(ex, `protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=nestJs=true:. ./hero.proto`)
Additionally, multiple proto [sample programs](https://github.com/grpc/grpc-node/tree/master/examples) written as separate clients/servers demonstrate compatibility with the sample programs in `@grpc/grpc-js`. @@ -31,7 +31,7 @@ gRPC Client / gRPC Server that use the same [proto file](https://github.com/grpc |-------------------------------------------------------------------------------------------------------------|------------------------------------|------------------------------------| | [grpc-node/examples/helloworld/](https://github.com/grpc/grpc-node/tree/master/examples/helloworld) | **c-1** `$ node greeter_client.js` | **s-1** `$ node greeter_server.js` | | [grpc-node/examples/error_handling/](https://github.com/grpc/grpc-node/tree/master/examples/error_handling) | **c-2** `$ node client.js` | **s-2** `$ node server.js` | -| nest/sample/34-grpc-client-server/ | **c-3** `client$ npm start` | **s-3** `server$ npm start` | +| nest/sample/04-grpc/ | **c-3** `client$ npm start` | **s-3** `server$ npm start` | - **c-1** --> **s-1**, **s-3** ```shell diff --git a/sample/04-grpc/.eslintrc.js b/sample/04-grpc/client/.eslintrc.js similarity index 100% rename from sample/04-grpc/.eslintrc.js rename to sample/04-grpc/client/.eslintrc.js diff --git a/sample/04-grpc/.gitignore b/sample/04-grpc/client/.gitignore similarity index 100% rename from sample/04-grpc/.gitignore rename to sample/04-grpc/client/.gitignore diff --git a/sample/04-grpc/nest-cli.json b/sample/04-grpc/client/nest-cli.json similarity index 100% rename from sample/04-grpc/nest-cli.json rename to sample/04-grpc/client/nest-cli.json diff --git a/sample/34-grpc-client-server/client/package-lock.json b/sample/04-grpc/client/package-lock.json similarity index 100% rename from sample/34-grpc-client-server/client/package-lock.json rename to sample/04-grpc/client/package-lock.json diff --git a/sample/34-grpc-client-server/client/package.json b/sample/04-grpc/client/package.json similarity index 100% rename from sample/34-grpc-client-server/client/package.json rename to sample/04-grpc/client/package.json diff --git a/sample/34-grpc-client-server/client/src/app.module.ts b/sample/04-grpc/client/src/app.module.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/app.module.ts rename to sample/04-grpc/client/src/app.module.ts diff --git a/sample/34-grpc-client-server/client/src/helloworld/helloworld.controller.ts b/sample/04-grpc/client/src/helloworld/helloworld.controller.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/helloworld/helloworld.controller.ts rename to sample/04-grpc/client/src/helloworld/helloworld.controller.ts diff --git a/sample/34-grpc-client-server/client/src/helloworld/helloworld.module.ts b/sample/04-grpc/client/src/helloworld/helloworld.module.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/helloworld/helloworld.module.ts rename to sample/04-grpc/client/src/helloworld/helloworld.module.ts diff --git a/sample/34-grpc-client-server/client/src/hero/hero.controller.ts b/sample/04-grpc/client/src/hero/hero.controller.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/hero/hero.controller.ts rename to sample/04-grpc/client/src/hero/hero.controller.ts diff --git a/sample/34-grpc-client-server/client/src/hero/hero.module.ts b/sample/04-grpc/client/src/hero/hero.module.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/hero/hero.module.ts rename to sample/04-grpc/client/src/hero/hero.module.ts diff --git a/sample/34-grpc-client-server/client/src/interface/helloworld.ts b/sample/04-grpc/client/src/interface/helloworld.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/interface/helloworld.ts rename to sample/04-grpc/client/src/interface/helloworld.ts diff --git a/sample/34-grpc-client-server/client/src/interface/hero.ts b/sample/04-grpc/client/src/interface/hero.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/interface/hero.ts rename to sample/04-grpc/client/src/interface/hero.ts diff --git a/sample/34-grpc-client-server/client/src/main.ts b/sample/04-grpc/client/src/main.ts similarity index 100% rename from sample/34-grpc-client-server/client/src/main.ts rename to sample/04-grpc/client/src/main.ts diff --git a/sample/04-grpc/tsconfig.build.json b/sample/04-grpc/client/tsconfig.build.json similarity index 100% rename from sample/04-grpc/tsconfig.build.json rename to sample/04-grpc/client/tsconfig.build.json diff --git a/sample/34-grpc-client-server/client/tsconfig.json b/sample/04-grpc/client/tsconfig.json similarity index 100% rename from sample/34-grpc-client-server/client/tsconfig.json rename to sample/04-grpc/client/tsconfig.json diff --git a/sample/34-grpc-client-server/client/.eslintrc.js b/sample/04-grpc/hybrid/.eslintrc.js similarity index 100% rename from sample/34-grpc-client-server/client/.eslintrc.js rename to sample/04-grpc/hybrid/.eslintrc.js diff --git a/sample/34-grpc-client-server/client/.gitignore b/sample/04-grpc/hybrid/.gitignore similarity index 100% rename from sample/34-grpc-client-server/client/.gitignore rename to sample/04-grpc/hybrid/.gitignore diff --git a/sample/34-grpc-client-server/client/nest-cli.json b/sample/04-grpc/hybrid/nest-cli.json similarity index 100% rename from sample/34-grpc-client-server/client/nest-cli.json rename to sample/04-grpc/hybrid/nest-cli.json diff --git a/sample/04-grpc/package-lock.json b/sample/04-grpc/hybrid/package-lock.json similarity index 100% rename from sample/04-grpc/package-lock.json rename to sample/04-grpc/hybrid/package-lock.json diff --git a/sample/04-grpc/package.json b/sample/04-grpc/hybrid/package.json similarity index 100% rename from sample/04-grpc/package.json rename to sample/04-grpc/hybrid/package.json diff --git a/sample/04-grpc/src/app.module.ts b/sample/04-grpc/hybrid/src/app.module.ts similarity index 100% rename from sample/04-grpc/src/app.module.ts rename to sample/04-grpc/hybrid/src/app.module.ts diff --git a/sample/04-grpc/src/grpc-client.options.ts b/sample/04-grpc/hybrid/src/grpc-client.options.ts similarity index 100% rename from sample/04-grpc/src/grpc-client.options.ts rename to sample/04-grpc/hybrid/src/grpc-client.options.ts diff --git a/sample/04-grpc/src/hero/hero.controller.ts b/sample/04-grpc/hybrid/src/hero/hero.controller.ts similarity index 100% rename from sample/04-grpc/src/hero/hero.controller.ts rename to sample/04-grpc/hybrid/src/hero/hero.controller.ts diff --git a/sample/04-grpc/src/hero/hero.module.ts b/sample/04-grpc/hybrid/src/hero/hero.module.ts similarity index 100% rename from sample/04-grpc/src/hero/hero.module.ts rename to sample/04-grpc/hybrid/src/hero/hero.module.ts diff --git a/sample/04-grpc/src/hero/hero.proto b/sample/04-grpc/hybrid/src/hero/hero.proto similarity index 100% rename from sample/04-grpc/src/hero/hero.proto rename to sample/04-grpc/hybrid/src/hero/hero.proto diff --git a/sample/04-grpc/src/hero/interfaces/hero-by-id.interface.ts b/sample/04-grpc/hybrid/src/hero/interfaces/hero-by-id.interface.ts similarity index 100% rename from sample/04-grpc/src/hero/interfaces/hero-by-id.interface.ts rename to sample/04-grpc/hybrid/src/hero/interfaces/hero-by-id.interface.ts diff --git a/sample/04-grpc/src/hero/interfaces/hero.interface.ts b/sample/04-grpc/hybrid/src/hero/interfaces/hero.interface.ts similarity index 100% rename from sample/04-grpc/src/hero/interfaces/hero.interface.ts rename to sample/04-grpc/hybrid/src/hero/interfaces/hero.interface.ts diff --git a/sample/04-grpc/src/main.ts b/sample/04-grpc/hybrid/src/main.ts similarity index 100% rename from sample/04-grpc/src/main.ts rename to sample/04-grpc/hybrid/src/main.ts diff --git a/sample/34-grpc-client-server/client/tsconfig.build.json b/sample/04-grpc/hybrid/tsconfig.build.json similarity index 100% rename from sample/34-grpc-client-server/client/tsconfig.build.json rename to sample/04-grpc/hybrid/tsconfig.build.json diff --git a/sample/04-grpc/tsconfig.json b/sample/04-grpc/hybrid/tsconfig.json similarity index 100% rename from sample/04-grpc/tsconfig.json rename to sample/04-grpc/hybrid/tsconfig.json diff --git a/sample/34-grpc-client-server/proto/helloworld.proto b/sample/04-grpc/proto/helloworld.proto similarity index 100% rename from sample/34-grpc-client-server/proto/helloworld.proto rename to sample/04-grpc/proto/helloworld.proto diff --git a/sample/34-grpc-client-server/proto/hero.proto b/sample/04-grpc/proto/hero.proto similarity index 100% rename from sample/34-grpc-client-server/proto/hero.proto rename to sample/04-grpc/proto/hero.proto diff --git a/sample/34-grpc-client-server/server/.eslintrc.js b/sample/04-grpc/server/.eslintrc.js similarity index 100% rename from sample/34-grpc-client-server/server/.eslintrc.js rename to sample/04-grpc/server/.eslintrc.js diff --git a/sample/34-grpc-client-server/server/.gitignore b/sample/04-grpc/server/.gitignore similarity index 100% rename from sample/34-grpc-client-server/server/.gitignore rename to sample/04-grpc/server/.gitignore diff --git a/sample/34-grpc-client-server/server/nest-cli.json b/sample/04-grpc/server/nest-cli.json similarity index 100% rename from sample/34-grpc-client-server/server/nest-cli.json rename to sample/04-grpc/server/nest-cli.json diff --git a/sample/34-grpc-client-server/server/package-lock.json b/sample/04-grpc/server/package-lock.json similarity index 100% rename from sample/34-grpc-client-server/server/package-lock.json rename to sample/04-grpc/server/package-lock.json diff --git a/sample/34-grpc-client-server/server/package.json b/sample/04-grpc/server/package.json similarity index 100% rename from sample/34-grpc-client-server/server/package.json rename to sample/04-grpc/server/package.json diff --git a/sample/34-grpc-client-server/server/src/app.module.ts b/sample/04-grpc/server/src/app.module.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/app.module.ts rename to sample/04-grpc/server/src/app.module.ts diff --git a/sample/34-grpc-client-server/server/src/helloworld/helloworld.controller.ts b/sample/04-grpc/server/src/helloworld/helloworld.controller.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/helloworld/helloworld.controller.ts rename to sample/04-grpc/server/src/helloworld/helloworld.controller.ts diff --git a/sample/34-grpc-client-server/server/src/helloworld/helloworld.module.ts b/sample/04-grpc/server/src/helloworld/helloworld.module.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/helloworld/helloworld.module.ts rename to sample/04-grpc/server/src/helloworld/helloworld.module.ts diff --git a/sample/34-grpc-client-server/server/src/hero/hero.controller.ts b/sample/04-grpc/server/src/hero/hero.controller.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/hero/hero.controller.ts rename to sample/04-grpc/server/src/hero/hero.controller.ts diff --git a/sample/34-grpc-client-server/server/src/hero/hero.module.ts b/sample/04-grpc/server/src/hero/hero.module.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/hero/hero.module.ts rename to sample/04-grpc/server/src/hero/hero.module.ts diff --git a/sample/34-grpc-client-server/server/src/interface/helloworld.ts b/sample/04-grpc/server/src/interface/helloworld.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/interface/helloworld.ts rename to sample/04-grpc/server/src/interface/helloworld.ts diff --git a/sample/34-grpc-client-server/server/src/interface/hero.ts b/sample/04-grpc/server/src/interface/hero.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/interface/hero.ts rename to sample/04-grpc/server/src/interface/hero.ts diff --git a/sample/34-grpc-client-server/server/src/main.ts b/sample/04-grpc/server/src/main.ts similarity index 100% rename from sample/34-grpc-client-server/server/src/main.ts rename to sample/04-grpc/server/src/main.ts diff --git a/sample/34-grpc-client-server/server/tsconfig.build.json b/sample/04-grpc/server/tsconfig.build.json similarity index 100% rename from sample/34-grpc-client-server/server/tsconfig.build.json rename to sample/04-grpc/server/tsconfig.build.json diff --git a/sample/34-grpc-client-server/server/tsconfig.json b/sample/04-grpc/server/tsconfig.json similarity index 100% rename from sample/34-grpc-client-server/server/tsconfig.json rename to sample/04-grpc/server/tsconfig.json