|
1 |
| -[]() |
2 |
| -[](https://github.com/dapr/js-sdk/blob/master/LICENSE) |
3 |
| -[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fdapr%2Fcomponents-contrib?ref=badge_shield) |
| 1 | +<p align="center"> |
| 2 | + <a href="https://dapr.io"> |
| 3 | + <img src="https://dapr.io/images/dapr.svg" height="128"> |
| 4 | + <h1 align="center">Dapr</h1> |
| 5 | + </a> |
| 6 | +</p> |
| 7 | + |
| 8 | +<p align="center"> |
| 9 | + <a aria-label="NPM version" href="https://www.npmjs.com/package/@dapr/dapr"> |
| 10 | + <img alt="" src="https://img.shields.io/npm/v/@dapr/dapr?style=for-the-badge&labelColor=000000"> |
| 11 | + </a> |
| 12 | + <a aria-label="License" href="https://github.com/dapr/js-sdk/blob/master/LICENSE"> |
| 13 | + <img alt="" src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=for-the-badge&labelColor=000000"> |
| 14 | + </a> |
| 15 | + <a aria-label="Join the community on Discord" href="https://discord.com/invite/ptHhX6jc34"> |
| 16 | + <img alt="" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&logo=Discord&labelColor=000000&logoWidth=20&logoColor=FFFFFF"> |
| 17 | + </a> |
| 18 | +</p> |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +Instantly get started by installing the Dapr JS SDK and reading the [getting started documentation](https://docs.dapr.io/developing-applications/sdks/js) or [follow one of the quickstarts](https://github.com/dapr/quickstarts) |
4 | 23 |
|
5 |
| -# Dapr Node.js SDKs |
6 |
| - |
7 |
| -The official [Dapr](https://dapr.io) Node.js SDK that allows interfacing with the Dapr sidecar for easy application building. |
8 |
| - |
9 |
| -## Introduction |
10 |
| - |
11 |
| -The Dapr JS SDK will allow you to interface with the Dapr process that abstracts several commonly used functionalities such as Service-to-Service invocation, State Management, PubSub, and more. |
12 |
| - |
13 |
| - |
14 |
| - |
15 |
| -Looking at the illustration above, we can see there will always always be another process (the Dapr Sidecar) running that your application will interface with. This process can either be started manually (e.g. through Dapr CLI) or injected as a container (e.g. through Kubernetes Sidecar injection in your pod). |
16 |
| - |
17 |
| -For your application to interface with this, 2 components should be taken into account: |
18 |
| -* **DaprServer:** Dapr Sidecar -> our Application - When we Subscribe to a Topic, Create an Actor, ... we receive an event from the Dapr process that abstracted its implementation. Our application should thus listen to this (which this SDK helps you with). |
19 |
| -* **DaprClient:** Your Application -> Dapr Sidecar - When we want to Publish an Event, Execute a Binding, ... we will talk with the Dapr process that calls its implementation for us so that we don't have to write it ourself! |
20 |
| - |
21 |
| -## Simple Example |
| 24 | +``` |
| 25 | +npm install --save @dapr/dapr |
| 26 | +``` |
22 | 27 |
|
23 |
| -> [Full version](./examples/http/pubsub) |
| 28 | +> ⚠️ the [`dapr-client`](https://www.npmjs.com/package/dapr-client) package has been deprecated. Please see https://github.com/dapr/js-sdk/issues/259 for more information. |
24 | 29 |
|
25 |
| -As a simple example, consider the use case: "Creating a PubSub where we can publish a message on a Topic and also receive messages back from this topic". Normally for this use case we would have to look at the Broker that we want to utilize and implement their specificities. While as with Dapr we can use a simple SDK and configure the "component" that we want to interface with. |
| 30 | +## Documentation |
26 | 31 |
|
27 |
| -> 🤩 This also means that if we want to switch from one broker to another (e.g. [Azure Service Bus](https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-servicebus/) to [RabbitMQ](https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-rabbitmq/)) we just have to change the component implementation! |
| 32 | +Visit [https://docs.dapr.io/developing-applications/sdks/js/](https://docs.dapr.io/developing-applications/sdks/js/) to view the full documentation. |
28 | 33 |
|
29 |
| -**component.yaml** |
| 34 | +## Who is using Dapr? |
30 | 35 |
|
31 |
| -```yaml |
32 |
| -apiVersion: dapr.io/v1alpha1 |
33 |
| -kind: Component |
34 |
| -metadata: |
35 |
| - name: my-pubsub-component |
36 |
| - namespace: default |
37 |
| -spec: |
38 |
| - type: pubsub.rabbitmq |
39 |
| - version: v1 |
40 |
| - metadata: |
41 |
| - - name: host |
42 |
| - value: "amqp://localhost:5672" |
43 |
| -``` |
| 36 | +Dapr is used by the world's leading companies. |
44 | 37 |
|
45 |
| -**example.ts** |
| 38 | +<div align="center"> |
| 39 | + <img src="https://dapr.io/images/bosch.png" width="100px"> |
| 40 | + <img src="https://dapr.io/images/zeiss.png" width="100px"> |
| 41 | + <img src="https://dapr.io/images/alibaba.png" width="100px"> |
| 42 | + <img src="https://dapr.io/images/ignition-group.png" width="100px"> |
| 43 | + <img src="https://dapr.io/images/roadwork.png" width="100px"> |
| 44 | + <img src="https://dapr.io/images/autonavi.png" width="100px"> |
| 45 | + <img src="https://dapr.io/images/legentic.png" width="100px"> |
| 46 | + <img src="https://dapr.io/images/man-group.png" width="100px"> |
| 47 | +</div> |
46 | 48 |
|
47 |
| -```javascript |
48 |
| -import { DaprClient, DaprServer } from "@dapr/dapr"; |
| 49 | +View the main site [https://dapr.io/](https://dapr.io/) to learn more. |
49 | 50 |
|
50 |
| -const daprHost = "127.0.0.1"; // Dapr Sidecar Host |
51 |
| -const daprPort = "50000"; // Dapr Sidecar Port |
52 |
| -const serverHost = "127.0.0.1"; // App Host of this Example Server |
53 |
| -const serverPort = "50001"; // App Port of this Example Server |
| 51 | +## Community |
54 | 52 |
|
55 |
| -// Create a Server (will subscribe) |
56 |
| -const server = new DaprServer(serverHost, serverPort, daprHost, daprPort); |
57 |
| -await server.pubsub.subscribe("my-pubsub-component", "my-topic", async (data: any) => console.log(`Received: ${JSON.stringify(data)}`)); |
58 |
| -await server.start(); |
| 53 | +For the JS SDK we are utilizing [GitHub Communities](https://github.com/dapr/js-sdk/discussions) to track announcements, articles, and more! |
59 | 54 |
|
60 |
| -// Create a Client (will publish) |
61 |
| -const client = new DaprClient(daprHost, daprPort); |
62 |
| -await client.pubsub.publish("my-pubsub-component", "my-topic", { hello: "world" }); |
63 |
| -``` |
| 55 | +The General Dapr community can be found on [Discord](https://discord.com/invite/ptHhX6jc34), where you can ask questions, propose features, and share your thoughts. |
64 | 56 |
|
65 |
| -To start this we of course have to start the Dapr process with it. With the command below we can utilize the CLI to quickly test this: |
| 57 | +## Contributing |
66 | 58 |
|
67 |
| -```bash |
68 |
| -dapr run --app-id example-http-pubsub --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./components npm run start |
69 |
| -``` |
| 59 | +Please see our [Contributing Overview](https://docs.dapr.io/contributing/js-contributing/). |
70 | 60 |
|
71 |
| -Which will result in the message: |
| 61 | +### Good First Issues |
72 | 62 |
|
73 |
| -```bash |
74 |
| -Received: {"hello":"world"} |
75 |
| -``` |
| 63 | +We have a list of [good first issues](https://github.com/dapr/js-sdk/labels/good%20first%20issue) that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process. |
76 | 64 |
|
77 |
| -## Information & Links |
| 65 | +## Authors |
78 | 66 |
|
79 |
| -* [Reference](./documentation/reference.md) containing code snippets of how to use the different methods. |
80 |
| -* [Examples](./documentation/examples.md) containing examples you can use to build your application. |
81 |
| -* [Development](./documentation/development.md) containing pointers for getting started on how to contribute to the SDK. |
| 67 | +- [Xavier Geerinck](https://www.linkedin.com/in/xaviergeerinck/) ([@XavierGeerinck](https://twitter.com/XavierGeerinck)) – [M18X](https://xaviergeerinck.com/) & [Proximus](https://proximus.com) |
| 68 | +- [Shubham Sharma](https://www.linkedin.com/in/shubham1172/) ([@shubham1172](https://twitter.com/shubham1172)) – [Microsoft](https://microsoft.com) |
| 69 | +- [Amulya Varote](https://www.linkedin.com/in/amulya-varote-96954287/) - [Microsoft](https://microsoft.com) |
| 70 | +- [Tanvi Gour](https://www.linkedin.com/in/tanvigour/) - [Microsoft](https://microsoft.com) |
0 commit comments