Search code examples
node.jsgatewayloopbackjsstrongloop

Syntax error in loopback api gateway


I am following a tutorial :http://strongloop.com/strongblog/node-js-loopback-api-gateway-sample-applications/

and I am getting an error in the code underneath the Proxy heading in the link mentioned above.

Code against the error is

var proxy = require('./middleware/proxy');
var proxyOptions = require('./middleware/proxy/config.json');
app.use(proxy(proxyOptions));
{
 "rules": [
 "^/api/(.*)$ http://localhost:3002/api/$1 [P]"
          ]
}

the error message is enter image description here

is there any thing wrong with the json?


Solution

  • My Problem is solved the problem was that I did not run the API Server http://localhost:3002 where the request was to be sent. I was only running the proxy server whereas there should be an API Server running also to which the request was to be sent.