File tree Expand file tree Collapse file tree 1 file changed +1
-18
lines changed
daprdocs/content/en/js-sdk-docs Expand file tree Collapse file tree 1 file changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -52,29 +52,12 @@ The JavaScript SDK allows you to interface with all of the [Dapr building blocks
52
52
### Invoke a service
53
53
54
54
``` javascript
55
- import { DaprClient , DaprServer } from " @dapr/js-sdk" ;
55
+ import { DaprClient } from " @dapr/js-sdk" ;
56
56
57
57
const daprHost = " 127.0.0.1" ;
58
58
const daprPort = " 50050" ;
59
- const serverHost = " 127.0.0.1" ;
60
- const serverPort = " 50051" ;
61
59
62
60
async function start () {
63
- const server = new DaprServer (serverHost, serverPort);
64
-
65
- // POST listener
66
- await server .invoker .listen (" hello-world" , async (data : any ) => {
67
- return { hello: " world received from POST" };
68
- }, { method: HttpMethod .POST });
69
-
70
- // GET listener
71
- await server .invoker .listen (" hello-world" , async () => {
72
- return { hello: " world received from GET" };
73
- }, { method: HttpMethod .GET });
74
-
75
- // Start server after instantiating listeners
76
- await server .startServer ();
77
-
78
61
const client = new DaprClient (daprHost, daprPort);
79
62
80
63
const serviceAppId = " my-dapr-app-id" ;
You can’t perform that action at this time.
0 commit comments