mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-01-28 19:28:13 +00:00
20 lines
451 B
TypeScript
20 lines
451 B
TypeScript
import { Get, Inject, Provide } from '@midwayjs/decorator';
|
|
import { CoolController, BaseController } from '@cool-midway/core';
|
|
import { CoolMqttServe } from '@cool-midway/iot';
|
|
|
|
/**
|
|
* MQTT
|
|
*/
|
|
@Provide()
|
|
@CoolController()
|
|
export class IotMqttController extends BaseController {
|
|
@Inject()
|
|
coolMqttServe: CoolMqttServe;
|
|
|
|
@Get('/publish')
|
|
async publish() {
|
|
await this.coolMqttServe.publish('presence', 'hello');
|
|
return this.ok();
|
|
}
|
|
}
|