diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-02-23 18:08:38 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-02-23 18:08:38 +0100 |
| commit | 19516de0a43ac5f2b0afc9891bbef09d229ce4e6 (patch) | |
| tree | 224a5ecb4e3f6130c4a1c6b3b125421ee2d9a6a7 /examples/index.js | |
| parent | 542ebb603ecd8a60fc1daf50404cbc24a92e1d74 (diff) | |
allow arbitrary file upload for pdf
Diffstat (limited to 'examples/index.js')
| -rw-r--r-- | examples/index.js | 252 |
1 files changed, 136 insertions, 116 deletions
diff --git a/examples/index.js b/examples/index.js index c03550a..f08c752 100644 --- a/examples/index.js +++ b/examples/index.js @@ -1,108 +1,128 @@ -var okcms = require('..'); +var okcms = require(".."); -var isProduction = process.env.OK_PRODUCTION === 'true' +var isProduction = process.env.OK_PRODUCTION === "true"; var port = process.env.PORT || 1337; -var path = require('path') +var path = require("path"); -var app = okcms.createApp({ +var app = okcms + .createApp({ + root: "public", - root: 'public', + debug: !isProduction, + production: isProduction, - debug: !isProduction, - production: isProduction, - - admin: { - theme: 'okadmin', -// dashboard: { -// resources: { -// card: { -// groupBy: 'stack', -// descending: true -// } -// } -// }, - dashboard: { - resources: { - flour: { - display: 'image', - } - } - } - }, - - schemas: { - page: { - id: {type: 'string'}, - title: {type: 'string'}, - body: {type: 'text'}, - links: {type: 'link-list', textLabel: "A", linkLabel: "B"}, - }, - bread: { - type: {type: 'string', id: true}, - title: {type: 'string'}, - description: {type: 'text'}, - color: {type: 'enum', options: ["red","blue","green"]}, - rating: {type: 'enum', options: { - "e": "Everyone", - "ec": "Early Childhood", - "e10": "Everyone 10+", - "t": "Teen", - "m": "Mature", - "ao": "Adults Only", - "rp": "Rating Pending", - }}, - video: {type: 'video'}, - images: {type: 'gallery'} - }, - test: { - id: {type: 'string', hidden: true}, - title: {type: 'string'}, - flagged: {type: 'flag'}, - media: {type: 'media'}, + admin: { + theme: "okadmin", + // dashboard: { + // resources: { + // card: { + // groupBy: 'stack', + // descending: true + // } + // } + // }, + dashboard: { + resources: { + flour: { + display: "image", + }, + }, + }, }, - flour: { - id: {type: 'string', hidden: true}, - title: {type: 'string'}, - image: {type: 'image'}, - images: {type: 'triple-captioned-image-list'}, + + schemas: { + page: { + id: { type: "string" }, + title: { type: "string" }, + body: { type: "text" }, + links: { type: "link-list", textLabel: "A", linkLabel: "B" }, + }, + bread: { + type: { type: "string", id: true }, + title: { type: "string" }, + description: { type: "text" }, + color: { type: "enum", options: ["red", "blue", "green"] }, + rating: { + type: "enum", + options: { + e: "Everyone", + ec: "Early Childhood", + e10: "Everyone 10+", + t: "Teen", + m: "Mature", + ao: "Adults Only", + rp: "Rating Pending", + }, + }, + video: { type: "video" }, + 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" }, + images: { type: "triple-captioned-image-list" }, + }, }, - }, - resources: [ - { type: 'page', static: {id: 'about'}}, - { type: 'page', static: {id: 'contact'}}, - { type: 'bread' }, - { type: 'test' }, - { type: 'flour' }, - ], + resources: [ + { type: "page", static: { id: "about" } }, + { type: "page", static: { id: "contact" } }, + { type: "bread" }, + { type: "test" }, + { type: "flour" }, + ], - services: { - s3: { - 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"), - }, - -/* + services: { + s3: { + 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, + }, + file: { + allowed: true, + preserveFilename: false, + maxbytes: 100 * 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"), + }, + + /* push: { lib: require("./lib/okpush"), mongodbUrl: "mongodb://localhost/okpush_example", @@ -128,26 +148,26 @@ var app = okcms.createApp({ } }, */ - }, - - views: { - '/': { - data: [ - {type: 'bread', query: '*'}, - {type: 'page', query: '*'} - ] - }, - '/about': { - data: {type: 'page', query: 'about'} }, - '/contact': { - data: {type: 'page', query: 'contact'} - }, - '/:id': { - data: {type: 'bread', query: ':id'} - } - } -}).listen(port) + views: { + "/": { + data: [ + { type: "bread", query: "*" }, + { type: "page", query: "*" }, + ], + }, + "/about": { + data: { type: "page", query: "about" }, + }, + "/contact": { + data: { type: "page", query: "contact" }, + }, + "/:id": { + data: { type: "bread", query: ":id" }, + }, + }, + }) + .listen(port); -console.log('Server listening at port %d...', port); +console.log("Server listening at port %d...", port); |
