enRaiser
enRaiser

Reputation: 2636

keystoneJS as child_process

I want to create separate process for sending bulk emails so I kicked off a child process.

var cp = require('child_process');

Inside that process I am initialising a keystone, but not starting it. because starting will make it listen on HTTP port also. my intenstion is just to use its Database feature.

Is this possible.

Upvotes: 0

Views: 44

Answers (1)

enRaiser
enRaiser

Reputation: 2636

I resolved this issue by keystone.mongoose.connect. Thus I have just initialised the keystone, and mongoose and not initialised the server and express. This is sufficient for sending bulk emails.

 var keystone = require('keystone');

 keystone.init({
    'less': 'public',
    'view engine': 'jade',
    'user model': 'User',
    'emails': '../../templates/emails'
});

keystone.mongoose.connect("mongodb://localhost/mydb");
keystone.import('../../models');

Upvotes: 0

Related Questions