This commit is contained in:
gaoshuaixing
2020-12-22 15:39:16 +08:00
parent 157db438b3
commit bc6aa4fcd1
3 changed files with 19 additions and 2 deletions

View File

@@ -5,23 +5,25 @@ const BaseController = require('../base');
class SettingController extends BaseController {
async autoLaunchEnable() {
const self = this;
const { ctx } = this;
const data = {
title: 'hello electron-egg'
};
await ctx.render('index.ejs', data);
self.sendSuccess(data);
}
async autoLaunchDisable() {
const self = this;
const { ctx } = this;
const data = {
title: 'hello'
};
await ctx.render('hello.ejs', data);
self.sendSuccess(data);
}
}

View File

@@ -13,4 +13,7 @@ module.exports = app => {
// html
router.get('/home', controller.v1.home.index);
// 引入其他路由
require('./setting')(app);
};

12
app/router/setting.js Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
// open launch
router.get('/api/v1/setting/autoLaunchEnable', controller.v1.setting.autoLaunchEnable);
// close launch
router.get('/api/v1/setting/autoLaunchDisable', controller.v1.setting.autoLaunchDisable);
};