forked from vikingeducation/assignment_mad_lib_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.js
More file actions
34 lines (30 loc) · 988 Bytes
/
Copy pathrepl.js
File metadata and controls
34 lines (30 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const repl = require("repl").start({});
const faker = require("faker");
const mongoose = require("mongoose");
const models = require("./models");
// const helpers = require('./helpers');
const md5 = require("md5");
const uuid = require("uuid");
require("./mongo")().then(() => {
// ----------------------------------------
// Models/Helpers
// ----------------------------------------
repl.context.models = models;
// repl.context.helpers = helpers;
// ----------------------------------------
// Mongoose
// ----------------------------------------
Object.keys(models).forEach(key => {
repl.context[key] = mongoose.model(key);
});
// ----------------------------------------
// Libs
// ----------------------------------------
repl.context.faker = faker;
repl.context.md5 = md5;
repl.context.uuid = uuid;
// ----------------------------------------
// Logging
// ----------------------------------------
repl.context.lg = console.log;
});