Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Executing nodejs proxy error-Script exited with status code 0

Not applicable

I am trying to run a nodejs proxy that uses 'nock' module for creating a mock response as follows:

hello-world.js

var nock = require("nock");
var http = require("http");
var api = nock("http://javascriptplayground.com")
          .persist()
          .get("/test/")
          .reply(200, "Hello World");
http.get("http://javascriptplayground.com/test/", function(resp) {
  var str = "";
  resp.on("data", function(data) { str += data; });
  resp.on("end", function() {
    console.log("Got Result: ", str);
  });
});

I have installed the 'nock' module:

package.json

{
  "name": "apigee-nock-mock",
  "version": "1.0.0",
  "description": "This is an example of an Apigee API Proxy leveraging mock",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "nock": "^0.59.1"
  }
}

When i run the proxy it gives 404 error and logs gives "*** Script hello-world.js exited with status code 0" error.

Any help will be appreciated.

0 1 576
1 REPLY 1
Top Solution Authors