summaryrefslogtreecommitdiff
path: root/examples/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/index.js')
-rw-r--r--examples/index.js49
1 files changed, 23 insertions, 26 deletions
diff --git a/examples/index.js b/examples/index.js
index 1a7bbfb..1e74968 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -1,48 +1,45 @@
var okcms = require('..');
-var Page = okcms.OKResource('page', {
- title: { name: 'string' },
- body: { name: 'string' }
-});
-
-var Project = okcms.OKResource('project', {
- title: {name: 'string'},
- index: {name: 'integer'},
- category: {name: 'string'},
- body: {name: 'string'},
- videos: {name: 'array:uri'},
- images: {name: 'array:image'}
-});
-
var app = okcms.createApp({
root: 'www',
+ schemas: {
+ page: {
+ title: {type: 'string'},
+ body: {type: 'string'}
+ },
+ project: {
+ title: {type: 'string'},
+ index: {type: 'integer'},
+ category: {type: 'enum'},
+ body: {type: 'string'},
+ videos: [{type: 'uri'}],
+ images: [{index: {type: 'string'}, uri: {type: 'uri'}}]
+ }
+ },
+
resources: [
- { resource: Page, id: 'about' },
- { resource: Page, id: 'contact' },
- { resource: Project, id: '*' },
+ { type: 'page', id: 'about' },
+ { type: 'page', id: 'contact' },
+ { type: 'project' },
],
views: {
'/': {
- template: 'index',
data: [
- {name: 'project', id: '*'},
- {name: 'page', id: '*'}
+ {type: 'project', id: '*'},
+ {type: 'page', id: '*'}
]
},
'/about': {
- template: 'page',
- data: {name: 'page', id: 'about'}
+ data: {type: 'page', id: 'about'}
},
'/contact': {
- template: 'page',
- data: {name: 'page', id: 'contact'}
+ data: {type: 'page', id: 'contact'}
},
'/:id': {
- template: 'project',
- data: {name: 'project', id: ':id'}
+ data: {type: 'project', id: ':id'}
}
}