Hello There I have a working Node.js Script but need help splitting on variable which is a string into 2 variables using the : symbol which is in the first variable
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
var queryData = url.parse(request.url, true).query;
response.writeHead(200, {"Content-Type": "text/plain"});
if (queryData.name) {
// user told us their name in the GET request, ex: http://host:8000/?name=Tom
var exec = require('child_process').exec;
exec ("casperjs test.js " + queryData.name + '\n',function(err, stdout, stderr) {
response.end(stdout);
});
} else {
response.end("Contact Admin - Not Working\n");
}
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8283);
I would like to be able to split queryData.name into something like below
exec ("casperjs test.js " + queryData.name1 + " " + queryData2.name + '\n',function(err, stdout, stderr)
QueryData contains a string like below
127.0.0.1:@mailserver1
I would like to split this so
+ queryData1.name + = 127.0.0.1
+ queryData2.name + = @mailserver1
so this would be using the : as a splitter