Skip to content

Commit 3756cee

Browse files
committed
simplify service invocation example
1 parent 0dc910f commit 3756cee

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

daprdocs/content/en/js-sdk-docs/_index.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,12 @@ The JavaScript SDK allows you to interface with all of the [Dapr building blocks
5252
### Invoke a service
5353

5454
```javascript
55-
import { DaprClient, DaprServer } from "@dapr/js-sdk";
55+
import { DaprClient } from "@dapr/js-sdk";
5656

5757
const daprHost = "127.0.0.1";
5858
const daprPort = "50050";
59-
const serverHost = "127.0.0.1";
60-
const serverPort = "50051";
6159

6260
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-
7861
const client = new DaprClient(daprHost, daprPort);
7962

8063
const serviceAppId = "my-dapr-app-id";

0 commit comments

Comments
 (0)