我如何绕过“内存中的角度网络API"用于特定的网址 [英] How I can bypass "angular-in-memory-web-api" for a specific url

查看:82
本文介绍了我如何绕过“内存中的角度网络API"用于特定的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当时使用内存中的角度Web-api"来模拟我的REST Web API,但是现在我已经开始编写实际的Web API,并且我想替换内存中的角度Web-API" api".

I was using "angular-in-memory-web-api" to mock my REST web api, however now I am have started writing the actual web api and I want to replace the "angular-in-memory-web-api" step by step.

示例: 我写了以下asp.net Web API /api/values 但是,当我使用上面的api url发出http.get()请求时,angular尝试使用"angular-in-memory-web-api"提供服务,但是在这种情况下,我想绕过"angular-in-memory-web-api" ",这样我的实际Web api控制器就会处理该请求.

Example: I have written following asp.net web api /api/values however when I issue http.get() request using above api url angular tries to serve it using "angular-in-memory-web-api", however in this case I want to bypass "angular-in-memory-web-api" so that request is entertained by my actual web api controller.

推荐答案

您可以将passThruUnknownUrl设置为转发到不匹配端点的真实后端

you can set passThruUnknownUrl to forward to real backend for un-matching endpoints

例如

InMemoryWebApiModule.forRoot(InMemoryDataService, {
  passThruUnknownUrl: true
}),

这篇关于我如何绕过“内存中的角度网络API"用于特定的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆