File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 16
16
"sinon" : " 12.0.1"
17
17
},
18
18
"scripts" : {
19
+ "seed" : " env NODE_ENV=development node ./seed" ,
19
20
"start" : " env NODE_ENV=development func start" ,
20
21
"deploy" : " rm -rf ./node_modules && npm install --production && func azure functionapp publish mongoosejs" ,
21
22
"test" : " env NODE_ENV=test mocha test/*.test.js" ,
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const assert = require ( 'assert' ) ;
4
+ const config = require ( '../.config' ) ;
5
+ const connect = require ( '../src/db' ) ;
6
+
7
+ assert . ok ( config . uri . includes ( 'localhost' ) , 'Can only seed localhost!' ) ;
8
+
9
+ run ( ) . catch ( err => {
10
+ console . log ( err ) ;
11
+ process . exit ( - 1 ) ;
12
+ } ) ;
13
+
14
+ async function run ( ) {
15
+ const conn = await connect ( ) ;
16
+
17
+ await conn . dropDatabase ( ) ;
18
+
19
+ const { Subscriber } = conn . models ;
20
+
21
+ await Subscriber . create ( [
22
+ {
23
+ githubUsername : 'vkarpov15' ,
24
+ githubUserId : '1620265'
25
+ } ,
26
+ {
27
+ githubUsername : 'IslandRhythms' ,
28
+ githubUserId : '39510674'
29
+ }
30
+ ] ) ;
31
+
32
+ console . log ( 'Done' ) ;
33
+ process . exit ( 0 ) ;
34
+ }
You can’t perform that action at this time.
0 commit comments