Run a command on a server based on an URL
The command takes a JSON as input and executes a web server based on the content.
The JSON must be structured as follows:
[
{
"url": "/some-url",
"cmd": "command to be ran on the server"
},
{
"url": "/some-other-url",
"cmd": "Another command to be ran on the server"
}
]
For example, it can be ran like this:
echo '[{"url":"/some-url","cmd":"do something"}]' | npm start
Or from a file:
cat urlsAndCmds.json | npm start