Make all example clients consistent

This commit is contained in:
Stanley Cheung 2018-08-29 16:25:07 -07:00
parent 8986a65618
commit fd6c9c4edc
9 changed files with 23 additions and 28 deletions

View File

@ -67,7 +67,7 @@ services:
- common
image: grpcweb/closure-client
ports:
- "80:80"
- "8081:8081"
ts-client:
build:
context: ./
@ -76,7 +76,7 @@ services:
- common
image: grpcweb/ts-client
ports:
- "8082:8082"
- "8081:8081"
binary-client:
build:
context: ./

View File

@ -27,7 +27,10 @@ $EXAMPLE_DIR/commonjs-example
RUN cd $EXAMPLE_DIR/commonjs-example && \
npm install && \
npm link grpc-web && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist
EXPOSE 8081
CMD ["nginx"]

View File

@ -26,5 +26,5 @@ RUN cd /github/grpc-web && \
RUN cd /github/grpc-web && \
make client && make install-example
EXPOSE 80
EXPOSE 8081
CMD ["nginx"]

View File

@ -25,7 +25,10 @@ $EXAMPLE_DIR/commonjs-example
RUN cd $EXAMPLE_DIR/commonjs-example && \
npm install && \
npm link grpc-web && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist
EXPOSE 8081
CMD ["nginx"]

View File

@ -26,7 +26,10 @@ RUN cd $EXAMPLE_DIR/ts-example && \
npm install && \
npm link grpc-web && \
tsc && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist
EXPOSE 8082
EXPOSE 8081
CMD ["nginx"]

View File

@ -93,10 +93,10 @@ proto-js:
--grpc-web_out=import_style=closure,mode=grpcwebtext:. ./echo.proto
install:
mkdir -p $(HTML_DIR)/$(EXAMPLES_PATH)
cp ./echotest.html $(HTML_DIR)/$(EXAMPLES_PATH)/
cp ./echoapp.js $(HTML_DIR)/$(EXAMPLES_PATH)/
cp compiled.js $(HTML_DIR)/echo_js_bin_dev.js
mkdir -p $(HTML_DIR)
cp ./echotest.html $(HTML_DIR)
cp ./echoapp.js $(HTML_DIR)
cp ./compiled.js $(HTML_DIR)/echo_js_bin_dev.js
clean:
rm -f *.grpc.pb.cc *.grpc.pb.h *.grpc.pb.o *.pb.cc *.pb.h *.pb.o \

View File

@ -60,7 +60,7 @@ we use a simple server to serve up the JS/HTML static contents.
```sh
$ docker build -t grpcweb/closure-client \
-f net/grpc/gateway/docker/closure_client/Dockerfile .
$ docker run -d -p 80:80 grpcweb/closure-client
$ docker run -d -p 8081:8081 grpcweb/closure-client
```
## Run the example from your browser

View File

@ -19,10 +19,10 @@
<title>Echo Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="../../../../../echo_js_bin_dev.js"></script>
<script type="text/javascript">
const module = {};
</script>
<script src="./echo_js_bin_dev.js"></script>
<script src="./echoapp.js"></script>
<script type="text/javascript">
var EchoServiceClient = proto.grpc.gateway.testing.EchoServiceClient;

View File

@ -11,24 +11,10 @@ events {
http {
access_log off;
server {
listen 80;
listen 8081;
server_name localhost;
location ~ \.(html|js)$ {
root /var/www/html;
}
}
server {
listen 8081;
server_name localhost;
location ~ \.(html|js)$ {
root /github/grpc-web/net/grpc/gateway/examples/echo/commonjs-example;
}
}
server {
listen 8082;
server_name localhost;
location ~ \.(html|js)$ {
root /github/grpc-web/net/grpc/gateway/examples/echo/ts-example;
}
}
}