This is a small proof of concept project based on grpc and grpc-web Improbables implementation, demostrating how any language based grpc server and a TypeScript frontend could work together.
You must have installed on your system:
-
node
Most of the project dependencies and running scripts are managed though node and its ecosystem, also the final server code is written in node. -
go
>= 1.8 Go language is used to deploy a grpc-web spec compatible proxy server. -
protoc
The protocol buffer compiler is needed since the TypeScript message and services definitions are generated on frontend compilation step out ofproto
files. For the server we are not using it, relying on a runtime generation based on Protobuf.js (this dependency is managed through npm, so you don't have to worry about it).
-
npm install
This command will install all needed dependencies to run the three components of the project (server, proxy and client). -
npm start
This will start the node grpc server, a grpc-web proxy based on go, and a webpack dev server for the TypeScript client. -
Go to
http://localhost:8081
and check the browser console.
HTTP2 requires TLS. This repository contains certificates in the misc/cert
directory. You can optionally generate your own replacements using the gen_cert.sh
in the same directory.
Follow this guide to accept the certificates in Chrome/Chromium.
-
npm run start:tls
will start the node grpc server, proxy and specific TLS enabled webpack dev server using the certificates frommisc/cert
. -
Go to
https://localhost:8082
and check the browser console.
Original projects which this project is based on can be found on: