mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
reacting to user entered 's' but only for json file
This commit is contained in:
@ -13,6 +13,15 @@ function loadFile(file, cb) {
|
||||
if (/\.js$/.test(file)) db = require(path).run();
|
||||
|
||||
cb(db);
|
||||
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', function (userInput) {
|
||||
console.log(userInput);
|
||||
if (userInput.trim().toLowerCase() == 's') {
|
||||
console.log('saving db');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadURL(url, cb) {
|
||||
|
Reference in New Issue
Block a user