File tree Expand file tree Collapse file tree
_examples/hello-webrpc/webapp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 - uses : actions/checkout@v3
1616 - name : Install webrpc-gen
1717 run : |
18- curl -o ./webrpc-gen -fLJO https://github.com/webrpc/webrpc/releases/download/v0.18.6 /webrpc-gen.linux-amd64
18+ curl -o ./webrpc-gen -fLJO https://github.com/webrpc/webrpc/releases/download/v0.32.3 /webrpc-gen.linux-amd64
1919 chmod +x ./webrpc-gen
2020 echo $PWD >> $GITHUB_PATH
2121
Original file line number Diff line number Diff line change 1- // hello-webrpc v1.0.0 4fc01b139e8de5a1eb11b0581cd706326a434708
1+ // hello-webrpc v1.0.0 7037367a376940060eaf2739a920c4dca4a6dc2e
22// --
3- // Code generated by webrpc-gen@v0.18.6 with ../../ generator. DO NOT EDIT.
3+ // Code generated by webrpc-gen@v0.32.3 with ../../ generator. DO NOT EDIT.
44//
55// webrpc-gen -schema=hello-api.ridl -target=../../ -exports=false -client -out=./webapp/client.gen.js
66
@@ -11,7 +11,7 @@ const WebRPCVersion = "v1"
1111const WebRPCSchemaVersion = "v1.0.0"
1212
1313// Schema hash generated from your RIDL schema
14- const WebRPCSchemaHash = "4fc01b139e8de5a1eb11b0581cd706326a434708 "
14+ const WebRPCSchemaHash = "7037367a376940060eaf2739a920c4dca4a6dc2e "
1515
1616//
1717// Types
Original file line number Diff line number Diff line change 11{{define " client" }}
22
3+ {{- $basepath := .BasePath -}}
4+ {{- $services := .Services -}}
35{{- $opts := .Opts -}}
46
5- {{- if .Services }}
7+ {{- if $services }}
68//
79// Client
810//
9- {{ range .Services }}
11+ {{ range $services }}
1012{{if $opts .exports }}export {{end }}class {{.Name }} {
1113 constructor(hostname, fetch) {
12- this.path = '/rpc/ {{.Name }}/'
14+ this.path = '{{ $basepath }} {{.Name }}/'
1315 this.hostname = hostname
1416 this.fetch = (input, init) = > fetch(input, init)
1517 }
Original file line number Diff line number Diff line change 6969
7070{{template " types" dict " Services" .Services " Types" .Types " Opts" $opts }}
7171{{- if $opts .client }}
72- {{template " client" dict " Services" .Services " Opts" $opts }}
72+ {{template " client" dict " BasePath " .BasePath " Services" .Services " Opts" $opts }}
7373 {{template " client_helpers" . }}
7474{{- end }}
7575{{- if $opts .server }}
76- {{template " server" dict " Services" .Services " Opts" $opts " TypeMap" $typeMap }}
76+ {{template " server" dict " BasePath " .BasePath " Services" .Services " Opts" $opts " TypeMap" $typeMap }}
7777{{- end }}
7878{{- end }}
Original file line number Diff line number Diff line change 11{{define " server" }}
22
3+ {{- $basepath := .Basepath -}}
34{{- $services := .Services -}}
45{{- $typeMap := .TypeMap -}}
56
@@ -37,7 +38,7 @@ import express from 'express'
3738 switch(requestPath) {
3839 {{range $_, $method := $service.Methods}}
3940
40- case "/rpc/ {{$service.Name}}/{{$method.Name}}": {
41+ case "{{$basepath}} {{$service.Name}}/{{$method.Name}}": {
4142 try {
4243 {{ range $_, $input := $method.Inputs }}
4344 {{- if not $input.Optional}}
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ export class Complex {
174174
175175export class TestApi {
176176 constructor ( hostname , fetch ) {
177- this . path = '/rpc /TestApi/'
177+ this . path = '/v1 /TestApi/'
178178 this . hostname = hostname
179179 this . fetch = ( ) => fetch
180180 }
You can’t perform that action at this time.
0 commit comments