Skip to content

Instantly share code, notes, and snippets.

@remy
Created July 10, 2018 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/eb87c8259c8b43d510f8be737f3c5d05 to your computer and use it in GitHub Desktop.
Save remy/eb87c8259c8b43d510f8be737f3c5d05 to your computer and use it in GitHub Desktop.
{
"script": "http.js",
"ext": "json",
"ignore": [".git", "node_modules/**/node_modules"],
"watch": "watchPath"
}
require('http').createServer((req, res) => res.end('ok')).listen(8000);
const nodemon = require('nodemon');
const spawn = require('child_process').spawn;
nodemon({
script: 'http.js',
ext: 'json',
ignore: ['.git', 'node_modules/**/node_modules'],
watch: ['./watch'],
}).on('restart', files => {
console.log(files.length, files);
/// process files
});
setInterval(() => {
console.log('touching data file');
spawn('touch', ['./watch/data.json']);
}, 1000);
{
"name": "1383",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"nodemon": "*"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment