123456789101112131415161718192021222324 |
- /* eslint-disable array-callback-return */
- 'use strict';
- // const UUID = require('uuid');
- const fs = require('fs');
- const path = require('path');
- const Controller = require('egg').Controller;
- class HomeController extends Controller {
- async home() {
- const { ctx } = this;
- ctx.response.type = 'html';
- ctx.body = fs.readFileSync(path.resolve(__dirname, '../public/index.html'));
- }
- async reboot() {
- try {
- await this.service.files.reboot();
- this.ctx.body = { errcode: 0, errmsg: '' };
- } catch (error) {
- // this.ctx.body = { errcode: -1, errmsg: error };
- throw error;
- }
- }
- }
- module.exports = HomeController;
|