quture-bootstrap
v1.1.0
Published
A basic bootstrap script in order to launch a {Quture} application
Downloads
12
Readme
quture-bootstrap
A package to bootstrap a quture-app
.
Introduction
The package exports a function that bootstraps Quture
applications into a HTTP
/ HTTPS
server.
Documentation can be found here.
Basic usage
'use strict';
const qutureApp = require('./my/quture/app');
const bootstrap = require('quture-bootstrap');
// Instantiate a server instance
let server = bootstrap.start(qutureApp);
// If the app.secure configuration option is set to true
// then you must provide the paths to the files containing
// the public key certificate
let server = bootstrap.start(qutureApp, {
key: path.join(__dirname, 'key.pem'),
certificate: path.join(__dirname, 'certificate.pem')
});
This package can also be used with the cluster
module as shown below:
'use strict';
const os = require('os');
const cluster = require('cluster');
const qutureApp = require('./my/quture/app');
const bootstrap = require('quture-bootstrap');
if (process.env.NODE_ENV !== 'testing' && process.env.NODE_ENV !== 'development' && cluster.isMaster) {
for (let i = 0; i < os.cpus().length; i++) {
cluster.fork();
}
cluster.on('exit', function (worker) {
debug('Worker %d died.', worker.id);
cluster.fork();
});
} else {
let server = bootstrap.start(qutureApp);
}