# first time, generate local certs
./config/certs/certs.sh
Run
Run Dev Mode
# start in watch mode
nx serve api
# start with TLS. ***To use with Envoy, start with TLS***
SECURE=true ng serve api
# to turn on logging for `request`
NODE_DEBUG=request ng serve api
DEBUG=typeorm:* ng serve api
# optionally you can run with prod env(environment.prod.ts) for testing! use this for testing only.
nx serve api --prod
start envoy
docker compose up envoy
Test Dev Mode
# test API directly (nestJS)
grpcurl -plaintext \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' 0.0.0.0:5001 yeti.echo.v1.EchoService/Echo
# test API directly (nestJS) with TLS
grpcurl -insecure \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' 0.0.0.0:5001 yeti.echo.v1.EchoService/Echo
# test API via envoy
grpcurl -plaintext \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' 0.0.0.0:9090 yeti.echo.v1.EchoService/Echo
# test API via envoy with TLS
grpcurl -cacert=config/certs/ca-cert.pem \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' localhost:9444 yeti.echo.v1.EchoService/Echo
# make sure `require_client_certificate: true` is enabled in `listeners.yaml` for following tests:
# test API via envoy with TLS, and client cert
grpcurl -cacert=config/certs/ca-cert.pem \
-cert=config/certs/client-cert.pem \
-key=config/certs/client-key.pem \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' localhost:9444 yeti.echo.v1.EchoService/Echo
# test with wrong client cert. This will fail!
grpcurl -cacert=config/certs/ca-cert.pem \
-cert=config/certs/upstream-cert.pem \
-key=config/certs/upstream-key.pem \
-protoset <(buf build -o -) \
-d '{"message": "sumo"}' localhost:9444 yeti.echo.v1.EchoService/Echo
# testing with request data from file.
grpcurl -cacert=config/certs/ca-cert.pem \
-protoset <(buf build -o -) \
-v -H trans_id=abc123 \
-d @ localhost:9444 yeti.echo.v1.EchoService/Echo <test/echo-request.json