-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
38 lines (34 loc) · 920 Bytes
/
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
const { Keystone } = require('@keystonejs/keystone');
const { Text, Integer } = require('@keystonejs/fields');
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 PROJECT_NAME = 'Movie Rating';
const keystone = new Keystone({
name: PROJECT_NAME,
adapter: new Adapter(),
});
// Define schema for movie ratings
keystone.createList('Movie', {
fields: {
title: {
type: Text,
isRequired: true,
isUnique: true
},
rating: {
type: Integer,
isRequired: true,
defaultValue: 10
}
},
});
module.exports = {
keystone,
apps: [
new GraphQLApp(),
new StaticApp({ path: '/', src: 'public' }),
new AdminUIApp({ enableDefaultRoute: true })
],
};