summaryrefslogtreecommitdiff
path: root/examples/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/index.js')
-rw-r--r--examples/index.js69
1 files changed, 65 insertions, 4 deletions
diff --git a/examples/index.js b/examples/index.js
index 0b9bf02..f1fabfa 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -1,14 +1,32 @@
var okcms = require('..');
+var isProduction = process.env.OK_PRODUCTION === 'true'
+var port = process.env.PORT || 1337;
+
var app = okcms.createApp({
root: 'public',
+ debug: !isProduction,
+ production: isProduction,
+
+ admin: {
+ dashboard: {
+ resources: {
+ card: {
+ groupBy: 'stack',
+ descending: true
+ }
+ }
+ },
+ },
+
schemas: {
page: {
id: {type: 'string'},
title: {type: 'string'},
- body: {type: 'text'}
+ body: {type: 'text'},
+ links: {type: 'link-list'},
},
bread: {
type: {type: 'string', id: true},
@@ -16,7 +34,27 @@ var app = okcms.createApp({
description: {type: 'text'},
color: {type: 'enum', options: ["red","blue","green"]},
video: {type: 'video'},
- images: {type: 'captioned-image-list'}
+ images: {type: 'gallery'}
+ },
+ test: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ flagged: {type: 'flag'},
+ media: {type: 'media'},
+ },
+ flour: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ image: {type: 'image'},
+ },
+ card: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ stack: {type: 'foreign-key', key: 'stack'},
+ },
+ stack: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
}
},
@@ -24,6 +62,10 @@ var app = okcms.createApp({
{ type: 'page', static: {id: 'about'}},
{ type: 'page', static: {id: 'contact'}},
{ type: 'bread' },
+ { type: 'test' },
+ { type: 'flour' },
+ { type: 'card' },
+ { type: 'stack' },
],
services: {
@@ -31,6 +73,25 @@ var app = okcms.createApp({
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
+ dirname: "okcms-example",
+ image: { allowed: true, preserveFilename: false, maxbytes: 2*1024*1024 },
+ video: { allowed: true, preserveFilename: true, maxbytes: 200*1024*1024 },
+ audio: { allowed: true, preserveFilename: true, maxbytes: 100*1024*1024 },
+ },
+
+ webhook: {
+ active: false,
+ secret: 'test',
+ command: '/path/to/build.sh',
+ },
+
+ example: {
+ lib: require("./lib/okexample"),
+ stuff: "things",
+ },
+
+ dumpfm: {
+ lib: require("./lib/okdumpfm"),
}
},
@@ -52,6 +113,6 @@ var app = okcms.createApp({
}
}
-}).listen(process.env.PORT || 1337);
+}).listen(port)
-console.log('Server listening at port ' + (process.env.PORT || 1337) + '...');
+console.log('Server listening at port %d...', port);