Преглед на файлове

modified by james 20210104

james преди 5 години
родител
ревизия
cf35a3de26
променени са 1 файла, в които са добавени 38 реда и са изтрити 28 реда
  1. 38 28
      app/controller/v1/home.js

+ 38 - 28
app/controller/v1/home.js

@@ -1,28 +1,38 @@
-'use strict';
-
-const BaseController = require('../base');
-
-class HomeController extends BaseController {
-
-  async index() {
-    const { ctx } = this;
-
-    const data = {
-      title: 'hello electron-egg'
-    };
-
-    await ctx.render('index.ejs', data);
-  }
-  
-  async hello() {
-    const { ctx } = this;
-
-    const data = {
-      title: 'hello'
-    };
-
-    await ctx.render('hello.ejs', data);
-  }
-}
-
-module.exports = HomeController;
+'use strict';
+
+const BaseController = require('../base');
+
+class HomeController extends BaseController {
+
+  async index() {
+    const { ctx } = this;
+
+    const data = {
+      title: 'hello electron-egg'
+    };
+
+    await ctx.render('index.ejs', data);
+  }
+  
+  async hello() {
+    const { ctx } = this;
+
+    const data = {
+      title: 'hello'
+    };
+
+    this.sendSuccess(data);
+  }
+
+  async helloPage() {
+    const { ctx } = this;
+
+    const data = {
+      title: 'hello'
+    };
+
+    await ctx.render('hello.ejs', data);
+  }
+}
+
+module.exports = HomeController;