This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Telegram: | |
https://t.me/AlexDaSoul | |
Instagram: | |
https://www.instagram.com/alexdasoul/ | |
Presentation: | |
https://docs.google.com/presentation/d/1qtCCXzCvCnnn-w5nv3Zvg3RQR0WNG5sgoVK_XWAOZno/edit?usp=sharing | |
SA: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { api as userEnum } from '@grpc-proto/user/user.enum'; | |
... | |
@GrpcMethod('UserService', 'CreateUser') | |
@UseFilters(RpcExceptionFilter.for('UserController::createUser')) | |
public createUser(data: CreateUserReqDTO): Observable<userApi.user.UserRes> { | |
return this.userService.createUser(data).pipe( | |
map(() => { | |
return { | |
status: userEnum.user.EStatus.SUCCESS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_internal_repr": { | |
"x-grpc-from": ["auth"], | |
"user-agent": ["grpc-node/1.24.2 grpc-c/8.0.0 (linux; chttp2; ganges)"] | |
}, | |
"flags": 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function grpcStream<T>(client: ClientReadableStream<T>): Observable<T> { | |
let stream: ClientReadableStream<T> = null; | |
let subscriptionCounter = 0; | |
const data: Observable<any> = new Observable((observer: Observer<T>) => { | |
if (subscriptionCounter === 0) { | |
stream = client; | |
} | |
subscriptionCounter++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const meta: grpc.Metadata = new grpc.Metadata({ Authorization: token }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker logs -f <container name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker:dev:down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker:dev:up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm run build:grpc:front |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grpcurl -plaintext - import-path ./grpc-proto/user -proto index.proto \ | |
-H 'X-Grpc-From: auth' -d '{ "email": "johndoe@mail.com", "password": "demo" }' \ | |
127.0.0.1:443 api.user.UserService/VerifyUser |
NewerOlder