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: CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,17 @@
1
1
# Changelog
2
2
3
+
## 3.x release
4
+
5
+
### v3.0.0
6
+
7
+
#### Breaking Changes
8
+
9
+
##### GENERAL: Serialization changed and data is correctly being serialized now
10
+
11
+
Previously when sending data, it could happen that it was incorrectly serialized. This has been resolved and a new serializer is in place that will automatically detect the Content-Type for the data when using the HTTP Protocol and serialize accordingly. Objects will be send as `application/json`, Cloud-Events as `applications/cloudevents+json`, Strings as `text/plain`, and others as `application/octet-stream`.
12
+
13
+
As an example, when performing `client.invoke` with `"hello world"` as data instead of an object, the `JSON.serialize` method would be called and we would receive `'"hello world"'` (notice the `'`). Now due to the new serializer we will correctly return the string type.
By proxying requests, we can utilize the unique capabilities that Dapr brings with its sidecar architecture such as service discovery, logging, etc., enabling us to instantly "upgrade" our gRPC services. This feature of gRPC proxying was demonstrated in [community call 41](https://www.youtube.com/watch?v=B_vkXqptpXY&t=71s).
83
97
84
-
### Creating a Proxy
98
+
####Creating a Proxy
85
99
86
100
To perform gRPC proxying, simply create a proxy by calling the `client.proxy.create()` method:
We can now call the methods as defined in our `GreeterClient` interface (which in this case is from the [Hello World example](https://github.com/grpc/grpc-go/blob/master/examples/helloworld/helloworld/helloworld.proto))
Copy file name to clipboardExpand all lines: daprdocs/content/en/js-sdk-docs/js-server/_index.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ const server = new DaprServer(serverHost, serverPort, daprHost, daprPort, Commun
45
45
46
46
To run the examples, you can use two different protocols to interact with the Dapr sidecar: HTTP (default) or gRPC.
47
47
48
-
### Using HTTP (default)
48
+
### Using HTTP (built-in express webserver)
49
49
50
50
```typescript
51
51
import { DaprServer } from"@dapr/dapr";
@@ -66,6 +66,48 @@ npm run start:dapr-http
66
66
67
67
> ℹ️ **Note:** The `app-port` is required here, as this is where our server will need to bind to. Dapr will check for the application to bind to this port, before finishing start-up.
68
68
69
+
### Using HTTP (bring your own express webserver)
70
+
71
+
Instead of using the built-in web server for Dapr sidecar to application communication, you can also bring your own instance. This is helpful in scenarios like when you are building a REST API back-end and want to integrate Dapr directly in it.
72
+
73
+
Note, this is currently available for [`express`](https://www.npmjs.com/package/express) only.
74
+
75
+
> 💡 Note: when using a custom web-server, the SDK will configure server properties like max body size, and add new routes to it. The routes are unique on their own to avoid any collisions with your application, but it's not guaranteed to not collide.
// Initialize subscriptions before the server starts, the Dapr sidecar uses it.
100
+
// This will also initialize the app server itself (removing the need for `app.listen` to be called).
101
+
awaitdaprServer.start();
102
+
```
103
+
104
+
After configuring the above, you can call your custom endpoint as you normally would:
105
+
106
+
```typescript
107
+
const res =awaitfetch(`http://127.0.0.1:50002/my-custom-endpoint`);
108
+
const json =awaitres.json();
109
+
```
110
+
69
111
### Using gRPC
70
112
71
113
Since HTTP is the default, you will have to adapt the communication protocol to use gRPC. You can do this by passing an extra argument to the client or server constructor.
0 commit comments