Web API + Client (angular) App

Discussion in 'Site Programming, Development and Design' started by CJ12, Aug 13, 2015.

  1. I'm trying to have an angular site at www.mydomain.com, which consists only of client-side code.
    Then a Web API at www.mydomain.com/api....which I created in visual studio.

    I don't really understand how to achieve both. I assume that I need two application starting points, one which is just /, and one which is /api....both the articles I read all got onto multiple domains and url rewriting, and I'm not sure I need to go down that path or not.

    Some guidance as to the basic steps would be appreciated!
     
  2. FredC

    FredC Winhost Staff

    Yes. You should set the api folder as an application root.
     
  3. @CJ12

    Were you successful in setting this up? I'm trying to do the the exact same thing and I too don't think I need to have two separate domains.

    My set up.

    I have a Winhost asp.net 4.x Max account.

    I have an Angular 7 UI with a 4.5 Web API. I tried what was suggested last night with no luck.
    / is where my angular client code is.
    I created a /api using the App Start Point tool, published my Web API to that directory, URLed out to the /api directory and of course, winhost says it cannot find an application.

    So, what it sounds like is, what I'would need to do is, create an MVC web app and have my Angular client code call the MVC controllers -- that's just hokey and it seems that Winhost should support this.
    Even if I were to buy another domain, it seems that Winhost is going to to always look for a web site instead of an api end point.


    Please help! :)
     
  4. Ah. I think I know what's going on here. See, when I create new APIs, I always strip out the client side that VS bolts on to it. Well, that would indeed be an "Application" that Winhost is looking for.
     
    ComputerMan likes this.

Share This Page