no sure how to verify
iancrowther opened this issue · comments
when i execute the program:
$ kick-off-koa run program.js
it runs the server, outputs the body and stops the server
The submission server will listen at port 4502
hello
how can i verify this?
the output I get is
The solution server will listen at port 4502
✗ Error connecting to solution server(http://localhost:4502/hello), options: {"timeout":5000,"maxRedirects":10}. Error: connect ECONNREFUSED
at exports._errnoException (util.js:742:11)
at Object.afterConnect [as oncomplete] (net.js:989:19)
I have included the src for reference:
var koa = require('koa');
var app = koa();
app.use(function *blah() {
// you can set the response body in handler like this
this.body = 'hello';
});
app.listen(process.argv[2]);
its 100% reproducible
can you change line 110 in $kick-off-koa/exercise.js
, https://github.com/koajs/kick-off-koa/blob/master/exercise.js#L110
make the setTimeout
interval to 1000 or some bigger number?
I updated to 1000
The submission server will listen at port 1061
The solution server will listen at port 1062
✗ Error connecting to solution server(http://localhost:1062/hello), options: {"timeout":5000,"maxRedirects":10}. Error: connect ECONNREFUSED
at exports._errnoException (util.js:742:11)
at Object.afterConnect [as oncomplete] (net.js:989:19)
Instead of selecting random ports, we must pick up available free ports.
On Jul 28, 2014 4:19 PM, "Ian Crowther" notifications@github.com wrote:
I updated to 1000
The submission server will listen at port 1061
The solution server will listen at port 1062
✗ Error connecting to solution server(http://localhost:1062/hello), options: {"timeout":5000,"maxRedirects":10}. Error: connect ECONNREFUSED
at exports._errnoException (util.js:742:11)
at Object.afterConnect as oncomplete—
Reply to this email directly or view it on GitHub
#5 (comment).
it's not work in my computer, both run
and verify
. The error info is just like the description above.
I have also tried to change the timeout, and also tried @iancrowther 's patch, the error occur as the same.
My env:
node v0.11.13 with nvm
Mac OSX 10.9.4
kick-off-koa v1.0.3
i updated the patch, please try again.
@lisposter try kick-off-koa@1.0.4
I get the same error here when verifying.
Updating to 1.0.4 didn't change anything.
@jguyon can you add some console.log
in your program.js
to see if the server is running or not?
@dead-horse The submission server seems to be running fine, it's the solution server that seems to have a problem.
The following program:
var koa = require('koa');
var app = koa();
var port = process.argv[2];
app.use(function *() {
if (this.path === '/hello' && this.method === 'GET') {
this.body = 'hello koa';
}
});
app.listen(port, function () {
console.log('Server listening at port ' + port);
});
produces the following output:
The submission server will listen at port 38208
The solution server will listen at port 47688
Server listening at port 38208
✗ Error connecting to solution server(http://localhost:47688/hello), options: {"timeout":5000,"maxRedirects":10}. Error: connect ECONNREFUSED
at exports._errnoException (util.js:742:11)
at Object.afterConnect [as oncomplete] (net.js:989:19)
@dead-horse v1.0.4 still not work :(
the program is work perfect in browser by running it using node --harmony directly.
hey everyone. please check out v1.1.0
@dead-horse Works like a charm. Thanks ;)
👍 May the ports be with you! :D
On Sun, Aug 17, 2014 at 7:26 PM, Jérôme Guyon notifications@github.com
wrote:
@dead-horse https://github.com/dead-horse Works like a charm. Thanks ;)
—
Reply to this email directly or view it on GitHub
#5 (comment).
'I am what I am because of who we all are'
h3manth.com http://www.h3manth.com
*-- Hemanth HM *