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.
- Host: GitHub
- URL: https://github.com/diegossl/iot-publisher-api
- Owner: diegossl
- License: mit
- Created: 2020-07-20T14:55:39.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T12:34:28.000Z (over 3 years ago)
- Last Synced: 2024-07-29T19:42:29.444Z (almost 2 years ago)
- Topics: api, expressjs, googlepubsub, pubsub, typescript
- Language: TypeScript
- Homepage:
- Size: 585 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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