| var modelCleanCyclic = require('./modelCleanCyclic'); | |
| var Example = new keystone.List('Example', {}); | |
| Example.schema.set('toJSON', { | |
| virtuals: true, | |
| transform: modelCleanCyclic.transformer | |
| }); |
| @echo off | |
| if "%PHPBIN%" == "" set PHPBIN=C:\path\to\PHP\executable\dir\.\php.exe | |
| "%PHPBIN%" "C:\path\to\composer.phar" %* |
| This GIST illustrates a hack to allow for configurable backend-url and admin styles in Keystone.js | |
| New deps introduced: | |
| - node-dir | |
| - shelljs | |
| New directory structure after running "yo keystone": | |
| . | |
| |____admin | |
| | |____assets |
#How does KeystoneJS render it's Admin UI
KeystoneJS is an open source framework for developing database-driven websites, applications and APIs in Node.js. It's built on Express and MongoDB.The easiest way to get started with KeystoneJS is to use Yeoman Generator.yo keystone will scaffold a new KeystoneJS project for you, and offer to set up blog, gallery, and enquiry (contact form) models + views.If you'd like to try the demo at first,here it is.
When I wrote this,keystone's stable version is 0.2.39,and 0.3.0 not published yet,so if you have a different version of KeystoneJS,the content maybe different.
##Generate a KeystoneJS Project
First up, you'll need Node.js >= 0.10.x and MongoDB >= 2.4.x installed. Then, install the Keystone generator:
| Schema.virtual('comments') | |
| //Returns comment owned by this product | |
| .get( | |
| async obj => await Comment | |
| .find({ 'owner': this._id, deleted: { $ne: true } }) | |
| .sort('-likesCount -date_modified') | |
| .limit(6) | |
| .exec() | |
| ); |
| // Simulate config options from your production environment by | |
| // customising the .env file in your project's root folder. | |
| require('dotenv')().load(); | |
| // Require keystone and i18n | |
| var keystone = require('keystone'), | |
| i18n= require('i18n'); | |
| // Initialise Keystone with your project's configuration. | |
| // See http://keystonejs.com/guide/config for available options |
As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.
- Install the required build-tools (some might already be installed on your system).
| version: grunt-cli v0.1.8 | |
| 1. Install node-inspector globally (-g) | |
| npm install -g node-inspector | |
| 2. Add debugger statements to your code | |
| 3. Run your grunt task in debug mode |