summaryrefslogtreecommitdiff
path: root/examples/index.js
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-01 18:27:51 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-01 18:27:51 -0400
commit2e041ff6cd1b40c26bf16d37777c2c1c5153a669 (patch)
tree1e427659faf343bf42795beae8980000436617b8 /examples/index.js
parentae24790e8122296b06f88fa883b8e272c6454d46 (diff)
Bootstrappin young lad
Diffstat (limited to 'examples/index.js')
-rw-r--r--examples/index.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/index.js b/examples/index.js
new file mode 100644
index 0000000..1a7bbfb
--- /dev/null
+++ b/examples/index.js
@@ -0,0 +1,51 @@
+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',
+
+ resources: [
+ { resource: Page, id: 'about' },
+ { resource: Page, id: 'contact' },
+ { resource: Project, id: '*' },
+ ],
+
+ views: {
+ '/': {
+ template: 'index',
+ data: [
+ {name: 'project', id: '*'},
+ {name: 'page', id: '*'}
+ ]
+ },
+ '/about': {
+ template: 'page',
+ data: {name: 'page', id: 'about'}
+ },
+ '/contact': {
+ template: 'page',
+ data: {name: 'page', id: 'contact'}
+ },
+ '/:id': {
+ template: 'project',
+ data: {name: 'project', id: ':id'}
+ }
+ }
+
+}).listen(1337);
+
+console.log('Server listening at port 1337...');