# @sansitech/express-mqtt

> ```js const mqtt = require('mqtt'); const expressMqtt = require('@sansitech/express-mqtt');

Latest version **1.0.2** (published 2022-07-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install @sansitech/express-mqtt
pnpm add @sansitech/express-mqtt
yarn add @sansitech/express-mqtt
bun add @sansitech/express-mqtt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-07-14 |
| First published | 2020-08-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 22.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | seek |
| Maintainers | hanyuzhou2006, ccw |

## Links

- npm: https://www.npmjs.com/package/@sansitech/express-mqtt
- Repository: https://github.com/hanyuzhou2006/express-mqtt
- Homepage: https://github.com/hanyuzhou2006/express-mqtt#readme
- Issues: https://github.com/hanyuzhou2006/express-mqtt/issues
- npm.io page: https://npm.io/package/@sansitech/express-mqtt

## Dependencies (7)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [parseurl](https://npm.io/package/parseurl.md) ^1.3.3
- [utils-merge](https://npm.io/package/utils-merge.md) ^1.0.1
- [array-flatten](https://npm.io/package/array-flatten.md) ^3.0.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.1.0
- [setprototypeof](https://npm.io/package/setprototypeof.md) ^1.2.0
- [merge-descriptors](https://npm.io/package/merge-descriptors.md) ^1.0.1

## Recent versions

- 1.0.2 (latest) — 2022-07-14
- 1.0.1 — 2020-08-13
- 1.0.0 — 2020-08-13

## README

# Express Mqtt

```js
const mqtt = require('mqtt');
const expressMqtt = require('@sansitech/express-mqtt');

const client  = mqtt.connect('mqtt://test.mosquitto.org')
 
client.on('connect', function () {
  client.subscribe('test/hello', function (err) {
    if (!err) {
      client.publish('test/hello', 'Hello mqtt')
    }
  })
});


const app = expressMqtt(client);
// use it as express, support 
app.get('test/hello',(req,next)=>{
  console.log(`url:${req.url}`);
  req.ok = 'ok';
  next();
},(req)=>{
  console.log(`ok: ${req.ok}`)
});

```

---
_Source: https://npm.io/package/@sansitech/express-mqtt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
