Skip to content

nicholasaiello/go-http2-api-example

Repository files navigation

Generate New Certs

Run the following, and specify your local domain example.com for the Company Name:

$ openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout server.key -out server.crt

Build protobuf

Server

$ protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    proto/holdings.proto 

Client

$ protoc -I=./proto holdings.proto  \
    --js_out=import_style=commonjs:./client/js \
    --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./client/js

Configure Response

Use the following query params to modify the server response

push

Enable different response strategies

const PushModes = {
    OFF: '',
    ON: 'push',
};

chunks

Enable different response strategies

const ChunkModes = {
    OFF: '',
    ON: 'chunks',
};

size

Adjust how many total results are returned

About

Compare http1 response chunking and http2 server-push

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published