node.js code implementation

I have this code:

var http = require('http')

, url = require('url')

, util = require('util')

, exec = require('child_process').exec;

var site = [url removed, login to view](80, "[url removed, login to view]", false);

var req = [url removed, login to view]("GET", "/");

[url removed, login to view]();

[url removed, login to view]('response', function(res){

if([url removed, login to view] !== 200){

// launch a new instance

var ec2 = require("ec2")

, fs = require("fs");

// Read in the configuration above.

var configuration =

[url removed, login to view]([url removed, login to view]("[url removed, login to view]", "utf8"));

// Create an ec2 function that uses your configuration.

ec2 = ec2(configuration)

// Run an instance and wait for it to become ready.

ec2("RunInstances", {

ImageId: "ami-XXXXXX"

, KeyName: "micros-ie"

, InstanceType: "[url removed, login to view]"

, MinCount: 1

, MaxCount: 1

}, function (error, response) {

if (error) {

throw error




} else {

[url removed, login to view]('data', function(chunk){

function puts(error, stdout, stderr) { [url removed, login to view](stdout) }

exec("my command", puts);




basically, i would like to launch a new EC2 instance if the status code is not equal to 200. this works ok, but my problem is that when the code goes into the 'else' loop, i would like to check if the 'site' still returns a 200 status code.

So, i need this to be put into a function and then use recursion.

Also, the output of the exec("my command", puts); needs to be fed into a redis database.

Taidot: Javascript, node.js

Näytä lisää: node http util exec, when to use recursion, use of node.js, redis node.js, redis node, redis get, recursion problem, recursion function, javascript redis get, code get, redis nodejs, if js, get code, redis, nodejs, micros, javascript nodejs, create js, code check, status code

Tietoa työnantajasta:
( 7 arvostelua ) nimes, United Kingdom

Projektin tunnus: #1564347

7 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


We have an expert team for javascript and database handling.... Please provide a chance to work with you. Hope for good response.

€130 EUR 3 päivässä
(2 arvostelua)

wrapping what needed in a recursive function is not a problem. but are you sure you really need recursion here, not a 'while' loop? i have no working experience with redis, but its docs and docs for its node.js driv Lisää

€70 EUR 2 päivässä
(3 arvostelua)

I can help you, sir.

€80 EUR 3 päivässä
(4 arvostelua)


€150 EUR 3 päivässä
(0 arvostelua)

I have great easperience working with nodejs ( also i've had some contribtutions to the node-mongodb-native driver). You can check out some public work done here: [login to view URL] Thanks

€100 EUR 1 päivässä
(0 arvostelua)

Hello ! im a student of nodejs, and i can do this !

€30 EUR 3 päivässä
(0 arvostelua)

Not much experience with node as well as handling EC2 instances but what you require seems simple enough to increase my node-foo. Please pick while keeping in mind the aforementioned factor. :)

€30 EUR 4 päivässä
(0 arvostelua)