mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-24 08:08:10 +08:00
demo hello
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
2. 启动
|
||||
```
|
||||
# 进入目录 ./electron-egg/
|
||||
# 提升安装速度,使用国内镜像
|
||||
npm config set registry https://registry.npm.taobao.org
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
11
app/view/hello.ejs
Normal 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>
|
||||
Reference in New Issue
Block a user