Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
denodeify(mongoPrebuilt.start_server.bind(mongoPrebuilt))({
auto_shutdown: true,
args: {
port: MONGO_PORT,
dbpath,
},
})
.catch((errorCode) => {
const error = MONGO_CODES[errorCode];
console.error(`Failed to start MongoDB server on port ${MONGO_PORT}`);
console.error(`Error Code ${errorCode}: ${error ? error.longText : "Unknown"}`);
process.exit(1);
});
}
nodemon({
script: path.join('server', 'index.js'),
ext: 'js graphql',
exec: 'babel-node',
}).on('restart', () => console.log('Restarting server due to file change\n'));
// Ensure stopping our parent process will properly kill nodemon's process
// Ala https://www.exratione.com/2013/05/die-child-process-die/
// SIGTERM AND SIGINT will trigger the exit event.
process.once("SIGTERM", function () {
process.exit(0);
});
process.once("SIGINT", function () {
process.exit(0);
});
import nodemon from 'nodemon';
import path from 'path';
/* eslint-disable no-console */
nodemon({
script: path.join('server', 'index.js'),
ext: 'js graphql',
exec: 'babel-node',
}).on('restart', () => console.log('Restarting server due to file change\n'));
// Ensure stopping our parent process will properly kill nodemon's process
// Ala https://www.exratione.com/2013/05/die-child-process-die/
// SIGTERM AND SIGINT will trigger the exit event.
process.once('SIGTERM', () => {
process.exit(0);
});
process.once('SIGINT', () => {
process.exit(0);
});
// And the exit event shuts down the child.
denodeify(mongoPrebuilt.start_server.bind(mongoPrebuilt))({
auto_shutdown: true,
args: {
port: MONGO_PORT,
dbpath,
},
})
.catch((errorCode) => {
const error = MONGO_CODES[errorCode];
console.error(`Failed to start MongoDB server on port ${MONGO_PORT}`);
console.error(`Error Code ${errorCode}: ${error ? error.longText : "Unknown"}`);
process.exit(1);
});
}
nodemon({
script: path.join('server', 'index.js'),
ext: 'js graphql',
exec: 'babel-node',
}).on('restart', () => console.log('Restarting server due to file change\n'));
// Ensure stopping our parent process will properly kill nodemon's process
// Ala https://www.exratione.com/2013/05/die-child-process-die/
// SIGTERM AND SIGINT will trigger the exit event.
process.once("SIGTERM", function () {
process.exit(0);
});
process.once("SIGINT", function () {
process.exit(0);
});
const startNodemon = async function(config) {
const nodemon = new Nodemon(config)
// Otherwise Nodemon's log does not appear
// eslint-disable-next-line no-console, no-restricted-globals
nodemon.on('log', ({ colour }) => console.log(colour))
await promisify(nodemon.on.bind(nodemon))('start')
}
new Promise((resolve /* , reject */) => {
nodemon({
script: path.join(__dirname, 'server.js'),
env: { NODE_ENV: 'development' }
}).once('start', () => {
log.info('Starting nodemon')
opn(`http://localhost:${port}`)
resolve()
})
process.once('SIGTERM', () => {
process.exit(0)
})
process.once('SIGINT', () => {
process.exit(0)
})
})
restart().then(() => {
console.log()
log.info('Starting nodemon')
nodemon({
script: path.join(__dirname, 'server.js'),
ext: 'md js scss',
env: { NODE_ENV: 'development' },
ignore: ['node_modules', 'lib'],
watch: src(),
args: [
'--use_socket_server',
'--use_hot_reloader',
`--port ${PORT}`,
`--dir ${dist()}`,
],
})
.once('start', resolve)
.on('restart', (file) => {
clearTimeout(timer)
files.push(file)
gulp.task('start:server', () => {
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
nodemon(`-w index.js index.js`)
.on('log', onServerLog);
});
fs.readdir(text, (err1, files1) => {
if (err1) { reject(err1) }
if (!files1 || files1.length < 1) { reject(new Error(`Cant find any files in ${text}`)) }
nodemon({
script: path.join(__dirname, 'server.js'),
ext: 'md js scss',
env: { NODE_ENV: 'development' },
ignore: ['node_modules', 'lib'],
args: ['--use_socket_server', '--use_hot_reloader', `--port ${port}`],
watch: [conf.src]
}).once('start', () => {
log.info('Starting nodemon')
opn(`http://localhost:${port}`)
resolve()
restart()
}).on('restart', (files) => {
log.info(`Restarting server due to file change:\n:${files}`)
restart()
})
gulp.task('start:server', () => {
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
config = require(`./${serverPath}/config/environment`);
nodemon(`-w ${serverPath} ${serverPath}`)
.on('log', onServerLog);
});
gulp.task('_start-run-webserver', callback => {
let first = true
nodemon({
script: path.join(config.destinationDirectory, 'webserver'),
execMap: {
'': 'node'
},
env: {
PUBLIC_DIR: config.destinationPublicDirectory
}
}).on('start', function() {
if (first) {
first = false
callback()
}
})
})