ble-server/route/dashboard.js

41 lines
759 B
JavaScript
Raw Normal View History

2017-09-07 09:18:51 +00:00
/* eslint-disable no-throw-literal */
/* eslint-disable */
const KoaRouter = require('koa-router')
const router = new KoaRouter()
const fs = require('fs')
const path = require('path')
const Printer = require('../PrinterDev')
const KoaBody = require('koa-body')
const uuid = require('uuid')
/* eslint-enable */
router.use(async (c, n) => {
c.data = {
title: 'Printer System Dashboard'
}
let status = 1
try {
await n()
} catch (err) {
status = 0
if (typeof err === 'string') {
c.body = err
} else {
c.body = err.toString()
}
}
if (c.async) {
c.body = {
status,
msg: c.body
}
}
})
router.get('/', async (c, n) => {
await c.render('dashboard/index', c.data)
})
module.exports = router