mdasberg / ng-apimock

Node plugin that provides the ability to use scenario based api mocking: for local development for protractor testing
MIT License
99 stars 26 forks source link

Proxy config in Angular CLI instructions is unclear #13

Closed allanbond closed 7 years ago

allanbond commented 7 years ago

I had an issue getting ngMockapi working w/Angular CLI.

Could not select scenario [individual] thrown

I found that the proxy config (Step 3 in the Angular CLI instructions) only proxies requests that match "/api/*" to the mock data server.

It seems that requests generated from the ngMockapi API (like selectScenario()) also need to be proxied to the mock data server. The sample proxy config in the instructions doesn't include this.

In my case, I had to add an entry for ngapimock (see snippet). After that it seemed to work fine.

{
 "/activity/*": {
   "target": "http://localhost:3000",
   "secure": false,
   "logLevel": "debug"
 },
 "/ngapimock/*": {
   "target": "http://localhost:3000",
   "secure": false,
   "logLevel": "debug"
 }
}

Can you add that to the instructions? Or please advise if I'm missing something.

mdasberg commented 7 years ago

@allanbond thanks for pointing that out. I will update the documentation.