demo hello

This commit is contained in:
gaoshuaixing
2020-12-18 18:54:34 +08:00
parent d827c1d35b
commit 404484475e
4 changed files with 27 additions and 0 deletions

View File

@@ -32,6 +32,8 @@
2. 启动
```
# 进入目录 ./electron-egg/
# 提升安装速度,使用国内镜像
npm config set registry https://registry.npm.taobao.org
npm install
npm run dev
```

View File

@@ -14,6 +14,15 @@ class HomeController extends BaseController {
await ctx.render('index.ejs', data);
}
async hello() {
const { ctx } = this;
const data = {
title: 'hello'
};
await ctx.render('hello.ejs', data);
}
}
module.exports = HomeController;

View File

@@ -5,7 +5,12 @@
*/
module.exports = app => {
const { router, controller } = app;
// home
router.get('/', controller.v1.home.index);
// hello
//router.get('/', controller.v1.home.hello);
// html
router.get('/home', controller.v1.home.index);
};

11
app/view/hello.ejs Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1><%= title %></h1>
<p>Welcome to electron-egg</p>
</body>
</html>