Reputation: 183
I have scripts block in my package.json
"scripts": {
"start": "node ./node_modules/nodemon/bin/nodemon.js config/referenceBooks/girlsTypeInsert.js && src/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
but after executing my first script girlsTypeInsert.js
var GirlType = require("../../models/girlType");
var mongoose = require('mongoose');
var db = mongoose.connection;
mongoose.connect('mongodb://localhost:27017/posts');
db.on("error", console.error.bind(console, "connection error"));
db.once("open", function(callback){
console.log("Connection Succeeded");
});
GirlType.count({}, function(err, c) {
if (c > 4) {
console.log('Girls types already in db');
db.close();
} else {
GirlType.insertMany([{ name: "Shere"},
{ name: "Kaori Nazuka"},
{ name: "Main"},
{ name: "Reone"},
{ name: "Asakawa"}], function(err) {
if (err) throw err;
console.log("Girls types inserted in db");
db.close();
});
}
});
nodemon give me message
[nodemon] clean exit - waiting for changes before restart
what I need to change for starting my next script app.js?
Upvotes: 0
Views: 444
Reputation: 320
You should replace this
config/referenceBooks/girlsTypeInsert.js && src/app.js"
to
--exec \"config/referenceBooks/girlsTypeInsert.js && src/app.js\""
Upvotes: 1