diff --git a/cli/src/commands/get-second.js b/cli/src/commands/get-second.js new file mode 100644 index 0000000000000000000000000000000000000000..607fa533c6bdf9f91199ed2fd426141952415057 --- /dev/null +++ b/cli/src/commands/get-second.js @@ -0,0 +1,29 @@ +// @flow +const path = require("path"); +const chalk = require("chalk"); +const fs = require("fs"); +const util = require("util"); +const net = require("net"); +const process = require("process"); +var request = require("request"); + +const handleErrors = require("../utils/handleErrors"); +const getMaster = require("../utils/getMaster"); + +module.exports.command = "get-second"; +module.exports.describe = "Writes the names of the latest numversions of sdfsfilename to a localfilename."; +module.exports.builder = (yargs: any) => yargs; + +module.exports.handler = handleErrors(async (argv: {}) => { + const master = await getMaster() + var target = "http://"+ master + ":3000/getSecond/"; + request.post(target, function(error, response, body) { + console.log(body.toString()) + // fs.writeFile(argv.localfilename, body.toString(), function(err) { + // if (err) console.log(err) + // console.log("Written to " + process.cwd() + "/" + argv.localfilename) + // process.exit(0) + // }); + // process.exit(0) + }) +}); diff --git a/sfds/index.js b/sfds/index.js index 539070d8e5a6be5e762728d4b539814a31406e06..07819f9fbc74886157319fb4170f074d280c86dd 100644 --- a/sfds/index.js +++ b/sfds/index.js @@ -416,6 +416,12 @@ app.get("/sink", function(req, res) { } }); +app.post("/getSecond", function(req, res) { + // console.log("spout got: " + req.body.state); + // queue.push(req.body); + res.send("second"); +}); + round_robin = 0; setInterval(function sync() {