RoutePrefix和Route 路由前缀
使用应用到某个控制器中所有操作的路由前缀来批注该控制器。
web api
/// <summary> ////// </summary> [RoutePrefix("web/Business")] public class BusinessController : ApiController { /// <summary> ////// </summary> /// <param name="request"></param> /// <returns></returns> [Route("GetData"), System.Web.Http.HttpGet] public BusinessResponse GetData([FromUri]BusinessRequest request) { BusinessResponse response = new BusinessResponse(); response = Service.Execute(request);return response; } }
前端调用
var VueDataService = { apiUrls: { getUrl: BPMUtil.apiBasePath + "/Web/Business/GetData" }, getFormData: function (id) { return axios.get(this.apiUrls.getUrl + "?request.recordId=" + id); } };