-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
64 lines (57 loc) · 1.63 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
63
64
require('dotenv').config();
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 { MongooseAdapter } = require('@keystonejs/adapter-mongoose');
const { NextApp } = require('@keystonejs/app-next');
const {
Event,
Talk,
User,
Rsvp,
Organiser,
Sponsor,
Post,
Resource,
ForgottenPasswordToken,
Enquiry,
} = require('./schema');
const initialiseData = require('./initialData');
const keystone = new Keystone({
name: 'MusesCodeJS',
adapter: new MongooseAdapter({ mongoUri: 'mongodb://localhost/muses-code-js' }),
onConnect: initialiseData,
});
keystone.createList('Event', Event);
keystone.createList('Rsvp', Rsvp);
keystone.createList('Talk', Talk);
keystone.createList('User', User);
keystone.createList('Organiser', Organiser);
keystone.createList('Sponsor', Sponsor);
keystone.createList('Resource', Resource);
keystone.createList('ForgottenPasswordToken', ForgottenPasswordToken);
keystone.createList('Post', Post);
keystone.createList('Enquiry', Enquiry);
const authStrategy = keystone.createAuthStrategy({
type: PasswordAuthStrategy,
list: 'User',
});
const adminApp = new AdminUIApp({
adminPath: '/admin',
authStrategy,
pages: [
{
label: 'Meetup',
children: ['Event', 'Talk', 'Organiser', 'Sponsor', 'Post'],
},
{
label: 'People',
children: ['User', 'Rsvp', 'Enquiry'],
},
],
});
module.exports = {
keystone,
apps: [new GraphQLApp(), adminApp, new NextApp({ dir: 'site' })],
};