home.js 602 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const BaseController = require('../base');
  3. class HomeController extends BaseController {
  4. async index() {
  5. const { ctx } = this;
  6. const data = {
  7. title: 'hello electron-egg'
  8. };
  9. await ctx.render('index.ejs', data);
  10. }
  11. async hello() {
  12. const { ctx } = this;
  13. const data = {
  14. title: 'hello'
  15. };
  16. this.sendSuccess(data);
  17. }
  18. async helloPage() {
  19. const { ctx } = this;
  20. const data = {
  21. title: 'hello'
  22. };
  23. await ctx.render('hello.ejs', data);
  24. }
  25. }
  26. module.exports = HomeController;