Skip to content

Commit 7014dfc

Browse files
author
pedro
committed
update:统一js导出规范
1 parent 3e11e99 commit 7014dfc

23 files changed

Lines changed: 95 additions & 94 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
Lin-CMS 是林间有风团队经过大量项目实践所提炼出的一套**内容管理系统框
3131
**。Lin-CMS 可以有效的帮助开发者提高 CMS 的开发效率。
3232

33-
本项目是 Lin CMS 后端的 Flask 实现,需要前端?请访
33+
本项目是 Lin CMS 后端的 koa 实现,需要前端?请访
3434
[前端仓库](https://github.com/TaleLin/lin-cms-vue)
3535

3636
### 文档地址

app/api/cms/admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ const admin = new LinRouter({
3333
prefix: "/cms/admin"
3434
});
3535

36-
exports.admin = admin;
37-
3836
const adminDao = new AdminDao();
3937

4038
admin.linGet(
@@ -338,3 +336,5 @@ admin.linPost(
338336
);
339337
}
340338
);
339+
340+
module.exports = { admin };

app/api/cms/log.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const log = new LinRouter({
1010
prefix: "/cms/log"
1111
});
1212

13-
exports.log = log;
14-
1513
const logDao = new LogDao();
1614

1715
log.linGet(
@@ -81,3 +79,5 @@ log.linGet(
8179
ctx.json(arr);
8280
}
8381
);
82+
83+
module.exports = { log };

app/api/cms/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const test = new LinRouter({
1111
prefix: "/cms/test"
1212
});
1313

14-
exports.test = test;
15-
1614
test.get("/", async ctx => {
1715
ctx.type = "html";
1816
ctx.body = `<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor:
@@ -55,3 +53,5 @@ test.linGet(
5553
});
5654
}
5755
);
56+
57+
module.exports = { test };

app/api/cms/user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const user = new LinRouter({
2323
prefix: "/cms/user"
2424
});
2525

26-
exports.user = user;
27-
2826
const userDao = new UserDao();
2927

3028
user.linPost(
@@ -154,3 +152,5 @@ user.linGet(
154152
ctx.json(user);
155153
}
156154
);
155+
156+
module.exports = { user };

app/api/v1/book.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
"use strict";
22

3-
const { LinRouter, NotFound, Success, groupRequired } = require("lin-mizar");
3+
const {
4+
LinRouter,
5+
NotFound,
6+
Success,
7+
groupRequired,
8+
disableLoading
9+
} = require("lin-mizar");
410
const { getSafeParamId } = require("../../libs/util");
511
const {
612
BookSearchValidator,
@@ -18,10 +24,6 @@ const bookApi = new LinRouter({
1824
prefix: "/v1/book"
1925
});
2026

21-
exports.bookApi = bookApi;
22-
23-
// exports[disableLoading] = true;
24-
2527
// book 的dao 数据库访问层实例
2628
const bookDto = new BookDao();
2729

@@ -107,3 +109,5 @@ bookApi.get("/", async ctx => {
107109
}
108110
ctx.json(books);
109111
});
112+
113+
module.exports = { bookApi, [disableLoading]: false };

app/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ async function createApp () {
4040
return app;
4141
}
4242

43-
exports.createApp = createApp;
43+
module.exports = { createApp };

app/config/secure.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"use strict";
22

3-
exports.db = {
4-
database: "lin-cms4",
5-
host: "localhost",
6-
port: 3306,
7-
username: "root",
8-
password: "123456",
9-
logging: false
3+
module.exports = {
4+
db: {
5+
database: "lin-cms4",
6+
host: "localhost",
7+
port: 3306,
8+
username: "root",
9+
password: "123456",
10+
logging: false
11+
},
12+
secret:
13+
"\x88W\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJJU\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x95*4"
1014
};
11-
12-
exports.secret =
13-
"\x88W\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJJU\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x95*4";

app/config/setting.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
"use strict";
22

3-
exports.countDefault = 10;
4-
5-
exports.pageDefault = 0;
6-
7-
exports.apiDir = "app/api";
8-
9-
exports.accessExp = 60 * 60; // 1h 单位秒
10-
11-
// exports.refreshExp 设置refresh_token的过期时间
12-
13-
// 暂不启用
14-
exports.pluginPath = {
15-
// plugin name
16-
// poem: {
17-
// // determine a plugin work or not
18-
// enable: true,
19-
// // path of the plugin that relatived the workdir
20-
// path: "app/plugins/poem",
21-
// // other config
22-
// limit: 2
23-
// }
24-
// notify: {
25-
// enable: true,
26-
// path: "app/plugins/notify",
27-
// retry: 2000
28-
// }
3+
module.exports = {
4+
countDefault: 10,
5+
pageDefault: 0,
6+
apiDir: "app/api",
7+
accessExp: 60 * 60, // 1h 单位秒
8+
// debug 模式
9+
debug: true,
10+
// refreshExp 设置refresh_token的过期时间
11+
// 暂不启用插件
12+
pluginPath: {
13+
// plugin name
14+
// poem: {
15+
// // determine a plugin work or not
16+
// enable: true,
17+
// // path of the plugin that relatived the workdir
18+
// path: "app/plugins/poem",
19+
// // other config
20+
// limit: 2
21+
// }
22+
// notify: {
23+
// enable: true,
24+
// path: "app/plugins/notify",
25+
// retry: 2000
26+
// }
27+
}
2928
};

app/dao/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,4 @@ class AdminDao {
360360
}
361361
}
362362

363-
exports.AdminDao = AdminDao;
363+
module.exports = { AdminDao };

0 commit comments

Comments
 (0)