home.js 397 B

1234567891011121314
  1. /* eslint-disable array-callback-return */
  2. 'use strict';
  3. const fs = require('fs');
  4. const path = require('path');
  5. const Controller = require('egg').Controller;
  6. class HomeController extends Controller {
  7. async home() {
  8. const { ctx } = this;
  9. ctx.response.type = 'html';
  10. ctx.body = fs.readFileSync(path.resolve(__dirname, '../public/index.html'));
  11. }
  12. }
  13. module.exports = HomeController;