RicoSuter/NSwag

Set BaseUrl for Typescript clients?

Open

#1,198 创建于 2018年2月16日

在 GitHub 查看
 (10 评论) (0 反应) (0 负责人)C# (6,291 star) (1,189 fork)batch import
help wantedtype: enhancement

描述

NSwagStudio v11.15.3.0. Generating typescript client for C# web api controllers. My GUI is served from one url and the webapi is from another url (on the same machine). Just the path is different. I see in the generated ts file a baseUrl variable. This appears tied to the Studio's ServiceHost setting. I don't see any way to just provide a different path. If I set just the path into studio, '/MyProjectWebApi', it's prepending http: onto the beginning and it doesn't work. If I hand edit baseUrl to '/MyProjectWebApi', it does work.

Is there any way for me to set just an alternate path? but have it keep using whatever the app schema and host name was used?

If the ServiceHost starts with a '/', could it stop adding http? I tried experimenting with a '.', but no luck.

贡献者指南

Set BaseUrl for Typescript clients? · RicoSuter/NSwag#1198 | Good First Issue