mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 11:52:07 +08:00
1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
12
app/router/setting.js
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user