You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am a beginner in nodejs and require some help regarding the usage of yakbak. Hope, you don't mind :-)
Situation:
At present, I develop ASP.NET webmethods via Visual studio and manually test them. Once I start a visual studio project, the test url becomes: http://localhost/<random-but-valid-port-number>. This link can be opened via any web browser (e.g. chrome, firefox), for which I think node modules can use it also.
Code I tried:
I have started the visual studio project, and it has started on port 52280. Therefore, going to http://localhost/WebService1.asmx/Ping yields a valid timestamp (code written by me which I want to test). Code I have written in index.js:
// Contents of index.jstry{varyakbak=require('yakbak');varhttp=require('http');varvalidPort=52280;varproxy=http.createServer(yakbak('http://api.example.com',{dirname: __dirname}));proxy.listen(validPort,done);varoptions={host: 'http://localhost',port: validPort,path: '/WebService1.asmx/Ping'};http.get(options,function(resp){resp.on('data',function(chunk){console.log(chunk);});}).on("error",function(e){console.log("Got error: "+e.message);});}catch(e){console.log(e.message);console.trace();}
Example
If I try 'WebService1.asmx/Ping' then I would expect 2016-07-18T15:50:04.483+06:00 (current timestamp) as response and this response should be cached so that if I call this url later, then I will get the cached response instead of current timestamp.
Desired output
I want to control the variable options (i.e. path) and fetch response from that particular path. Then, I will compare the result in resp.on which will be same as the example output above. I expect yakbak to mock/cache the response.
However, I fixed the line and tried again. But got this error: listen EACCES 0.0.0.0:52280. So, I think yakbak's proxy (i.e. nodejs proxy) is not able to listen to the visual studio project's port.
Then, I wonder, how browsers are able to listen to that port?
Hello,
I am a beginner in nodejs and require some help regarding the usage of yakbak. Hope, you don't mind :-)
Situation:
At present, I develop ASP.NET webmethods via Visual studio and manually test them. Once I start a visual studio project, the test url becomes:
http://localhost/<random-but-valid-port-number>
. This link can be opened via any web browser (e.g. chrome, firefox), for which I think node modules can use it also.Code I tried:
I have started the visual studio project, and it has started on port 52280. Therefore, going to
http://localhost/WebService1.asmx/Ping
yields a valid timestamp (code written by me which I want to test). Code I have written inindex.js
:Example
If I try 'WebService1.asmx/Ping' then I would expect
2016-07-18T15:50:04.483+06:00
(current timestamp) as response and this response should be cached so that if I call this url later, then I will get the cached response instead of current timestamp.Desired output
I want to control the variable
options
(i.e. path) and fetch response from that particular path. Then, I will compare the result in resp.on which will be same as the example output above. I expect yakbak to mock/cache the response.Actual output
The text was updated successfully, but these errors were encountered: