home.js
386 Bytes
"use strict";
const Controller = require("egg").Controller;
const path = require("path");
const fs = require("fs");
class HomeController extends Controller {
async index() {
const { ctx } = this;
// ctx.body = 'hi, egg';
ctx.response.type = "html";
ctx.body = fs.readFileSync(path.resolve(__dirname, "../public/index.html"));
}
}
module.exports = HomeController;