UNPKG

pooliot-client

Version:
35 lines (28 loc) 967 B
import { newController } from 'alp-node/src'; import deviceService from '../../deviceService'; export default newController({ async index(ctx) { if (ctx.method !== 'GET') return (ctx.status = 404); ctx.body = await deviceService.getDisplayInfo(); }, async start(ctx) { if (ctx.method !== 'POST') return (ctx.status = 404); ctx.body = await deviceService.startDisplay(); }, async restart(ctx) { if (ctx.method !== 'POST') return (ctx.status = 404); ctx.body = await deviceService.restartDisplay(); }, async stop(ctx) { if (ctx.method !== 'POST') return (ctx.status = 404); ctx.body = await deviceService.stopDisplay(); }, async refresh(ctx) { if (ctx.method !== 'POST') return (ctx.status = 404); ctx.body = await deviceService.refreshDisplay(); }, async openboxStarted(ctx) { if (ctx.method !== 'POST') return (ctx.status = 404); ctx.body = await deviceService.setOpenboxStarted(); }, });