Sign inSign up

na4va4/js_mqtt

By na4va4

•Updated almost 2 years ago

Basic MQTT client integrated with an Express.js server.

Image
0

179

na4va4/js_mqtt repository overview

⁠js_mqtt

⁠Table of Contents

  1. General Info⁠
  2. Technologies⁠
  3. Installation⁠

⁠General Info


This project is a basic MQTT client integrated with an Express.js server. It connects to an MQTT broker, publishes a simple "Hello World" message in JSON format, and serves the last published message through an HTTP GET endpoint.

  • MQTT Publish:

    • Topic: test/hola
    • Message: {"message": "Hello World from MQTT in javascript"}
  • HTTP Endpoint:

    • Route: /
    • Response: Returns the last MQTT message in JSON format.

⁠Technologies


A list of technologies used within the project:

⁠Installation


Follow these steps to install and run the project:

⁠Via GitHub

Ensure you have Node.js installed on your machine:

node --version  
npm --version

Copy the repository

git clone https://github.com/nava2105/js_mqtt.git

Enter the directory

cd ../js_mqtt

Install the dependencies

npm install  

Run the server

node app.js

Open a browser and enter to Server: http://localhost:3000⁠

Or to review the endpoints in Swagger enter to http://localhost:3000/api-docs⁠

⁠Via Docker-hub

Pull the image from Docker-hub

docker pull na4va4/js_mqtt

Start a container from the image

docker run -p 3000:3000 na4va4/js_mqtt

Open a browser and enter to Server: http://localhost:3000⁠

Or to review the endpoints in Swagger enter to http://localhost:3000/api-docs⁠

Tag summary

Content type

Image

Digest

sha256:33927d5cf…

Size

58.9 MB

Last updated

almost 2 years ago

docker pull na4va4/js_mqtt