An open API service indexing awesome lists of open source software.

https://github.com/diegossl/iot-publisher-api

REST API for Publisher of the Google Cloud Pub / Sub service.
https://github.com/diegossl/iot-publisher-api

api expressjs googlepubsub pubsub typescript

Last synced: over 1 year ago
JSON representation

REST API for Publisher of the Google Cloud Pub / Sub service.

Awesome Lists containing this project

README

          

# IoT Publisher API with Google Cloud

In the software architecture, the publisher is part of the publish – subscribe project pattern, which is a message pattern in which message senders, called publishers, do not program messages to be sent directly to specific recipients, called subscribers, but categorize the messages. messages published in classes without knowing which subscribers, if any, may be. Likewise, subscribers express interest in one or more classes and receive only messages of interest, without knowing which publishers, if any, exist.

## Setup

To execute the project, it will be necessary to install the dependencies by typing the following command in the terminal:

```bash
yarn install
```

First of all, you must have the service account credentials to authenticate the Google Cloud Pub / Sub service via the API panel on the Google Cloud Platform. Then you need to paste these credentials, in JSON format, into the file **GoogleCredentials.json**, which is at the root of the project.

Credentials can be obtained from the following website:

[https://cloud.google.com/pubsub](https://cloud.google.com/pubsub)

Finally, to execute the project it is necessary to transpile the Typescript code to JavaScript. To do this, type the following command in the terminal:

```bash
yarn build
```

### Use

To execute the project already transpiled into JavaScript, type the following command in the terminal:

```bash
yarn start
```

### Example of data entry:

```javascript
{
"topicName": "test",
"data": "hello world"
}
```

## License

MIT