Install node-repl-promised:
npm install -g repl-promised
Use the repl to list all users
$ node-promised
> var app = require('./app');
undefined
> var Bookshelf = app.get('bookshelf');
undefined
> Bookshelf.models.User.query()
[ { id: 5,
email: 'chuck@norris.com',
name: 'Chuck Norris',
password_hash: '$2a$10$MuSVvgsOYGBMK12p4boSh.eX/FmmDXvbhrGfJcHPJQr0BLVEOrTcy',
created_at: 1411628445371,
updated_at: 1411628445371 } ]
>
If you want to have something pre-defined in your global context, you need to create your own repl initialization script:
var repl = require("repl").start({}),
promisify = require("repl-promised").promisify,
app = require('./app');
repl.context.models = app.get('bookshelf').models;
promisify(repl);
after that you can use models-variable directly:
$ node repl.js
> models.User.query()
[ { id: 5,
email: 'chuck@norris.com',
name: 'Chuck Norris',
password_hash: '$2a$10$MuSVvgsOYGBMK12p4boSh.eX/FmmDXvbhrGfJcHPJQr0BLVEOrTcy',
created_at: 1411628445371,
updated_at: 1411628445371 } ]
>
looks great, will try it and report back