How to use the nodemon function in nodemon

To help you get started, we’ve selected a few nodemon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmeasday / create-graphql-server / test / output-app / index.js View on Github external
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);
});
github staylor / graphql-wordpress / packages / draft-server / index.js View on Github external
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.
github tmeasday / create-graphql-server / skel / index.js View on Github external
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);
});
github ehmicky / autoserver / gulp / run.js View on Github external
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')
}
github triplecanopy / b-ber / src / tasks / serve.jsx View on Github external
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)
    })
  })
github triplecanopy / b-ber / packages / b-ber-create / src / bber-lib / watch.es6 View on Github external
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)
github Abdizriel / nodejs-microservice-starter / server / gulpfile.babel.js View on Github external
gulp.task('start:server', () => {
  process.env.NODE_ENV = process.env.NODE_ENV || 'development';
  nodemon(`-w index.js index.js`)
    .on('log', onServerLog);
});
github triplecanopy / b-ber / src / tasks / watch.jsx View on Github external
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()
      })
github syzer / game-recruitment / gulpfile.babel.js View on Github external
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);
});
github vslinko / esex / gulpfile.babel.js View on Github external
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()
    }
  })
})

nodemon

Simple monitor script for use during development of a Node.js app.

MIT
Latest version published 2 months ago

Package Health Score

97 / 100
Full package analysis