-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
62 lines (50 loc) · 1.57 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const { Keystone } = require('@keystonejs/keystone');
const { PasswordAuthStrategy } = require('@keystonejs/auth-password');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');
const {StaticApp}=require('@keystonejs/app-static');
const { MongooseAdapter: Adapter } = require('@keystonejs/adapter-mongoose');
const initialiseData = require('./utils/initial-data');
const UsersSchema = require('./lists/Users');
//内容、开源项目
const KnowledgesSchema = require('./lists/Knowledges.js');
//标签系统
const TagsSchema = require('./lists/Tags.js');
const CategoriesSchema = require('./lists/Categories.js');
//测试
const ApisSchema=require('./lists/Apis.js');
//实验室
const MLVideosSchema=require('./lists/MLVideos.js');
const PROJECT_NAME = "ai-mix";
const keystone = new Keystone({
name: PROJECT_NAME,
secureCookies:false,
adapter: new Adapter(),
onConnect: initialiseData,
});
keystone.createList('User', UsersSchema);
keystone.createList('Tag', TagsSchema);
keystone.createList('Category', CategoriesSchema);
keystone.createList('Knowledge', KnowledgesSchema);
keystone.createList('API',ApisSchema);
//实验室
keystone.createList('MLVideo',MLVideosSchema);
const authStrategy = keystone.createAuthStrategy({
type: PasswordAuthStrategy,
list: 'User',
});
module.exports = {
keystone,
apps: [
new GraphQLApp(),
new AdminUIApp({
enableDefaultRoute: true,
authStrategy,
}),
new StaticApp({
path:"/",
src:'public',
fallback:"newsBlog.html"
})
],
};