You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-11Lines changed: 30 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ An Elixir implementation of [gRPC](http://www.grpc.io/).
15
15
-[Usage](#usage)
16
16
-[Simple RPC](#simple-rpc)
17
17
-[HTTP Transcoding](#http-transcoding)
18
+
-[CORS](#cors)
18
19
-[Start Application](#start-application)
19
20
-[Features](#features)
20
21
-[Benchmark](#benchmark)
@@ -24,13 +25,13 @@ An Elixir implementation of [gRPC](http://www.grpc.io/).
24
25
25
26
The package can be installed as:
26
27
27
-
```elixir
28
-
defdepsdo
29
-
[
30
-
{:grpc, "~> 0.9"}
31
-
]
32
-
end
33
-
```
28
+
```elixir
29
+
defdepsdo
30
+
[
31
+
{:grpc, "~> 0.10"}
32
+
]
33
+
end
34
+
```
34
35
35
36
## Usage
36
37
@@ -59,10 +60,10 @@ service Greeter {
59
60
60
61
```
61
62
62
-
2. Then generate Elixir code from proto file as [protobuf-elixir](https://github.com/tony612/protobuf-elixir#usage) shows (especially the `gRPC Support` section) or using [protobuf_generate](https://hex.pm/packages/protobuf_generate) hex package. Example using `protobuf_generate` lib:
63
+
2. Then generate Elixir code from proto file as [protobuf-elixir](https://github.com/elixir-protobuf/protobuf#usage):
In the following sections you will see how to implement gRPC server logic.
@@ -96,7 +97,7 @@ end
96
97
97
98
We will use this module [in the gRPC server startup section](#start-application).
98
99
99
-
**__Note:__** For other types of RPC call like streams see [here](interop/lib/interop/server.ex).
100
+
**Note:** For other types of RPC call like streams see [here](interop/lib/interop/server.ex).
100
101
101
102
### **HTTP Transcoding**
102
103
@@ -152,6 +153,7 @@ mix protobuf.generate \
152
153
```
153
154
154
155
3. Enable http_transcode option in your Server module
156
+
155
157
```elixir
156
158
defmoduleHelloworld.Greeter.Serverdo
157
159
useGRPC.Server,
@@ -167,6 +169,23 @@ end
167
169
168
170
See full application code in [helloworld_transcoding](examples/helloworld_transcoding) example.
169
171
172
+
### **CORS**
173
+
174
+
When accessing gRPC from a browser via HTTP transcoding or gRPC-Web, CORS headers may be required for the browser to allow access to the gRPC endpoint. Adding CORS headers can be done by using `GRPC.Server.Interceptors.CORS` as an interceptor in your `GRPC.Endpoint` module, configuring it as decribed in the module documentation:
0 commit comments