Asp.net web API 2 separation Web client and web server development

Our web application is developed by 2 teams. One team works on the client side, with its own department for development, and the other works on the server side, as well as with its own development branch. The client and server work separately, each of them is a website on a different port. Websites are hosted on top of IIS Express during development, and during production they will run on top of IIS.

Our ideal situation is that each team can develop completely separately, and each time a development session ends, both teams merge their set of changes into a single branch to integrate, by which each team merges back into its development branch and continues.

For complete separation, we have x2 SERVER projects, one for processing real HTTP requests, and the other for a stub server. What answers to all requests of HTTP clients with default values ​​are in order so that the Client Team can test its code, regardless of the server’s functionality.

The problem is that both the “stub server” and the real server are the same port the client side project is directed to.

This leads to many annoying errors (mainly for a server-side command) when launching an application with a "server stub" instead of a real one, during reviews, tests, etc. The only solution for us is to create a virtual directory manually for a real web server project each time before starting / or after finding out that we are starting the wrong server.

Is there a smarter solution to overcome this annoying problem? It will improve our life!

If anything I said was stupid / incomprehensible, please correct me (I'm new to this), or ask for more details, I will be happy!

Thanks for the helpers!

+1
source share
1 answer

I believe that your problem is more related to build automation, and then to server configuration. You really need to keep the stub server and the real server in separate ports and change this port during any build process of your client.

If you are using AngularJS, I suggest that you create steps in the build process of your client application using common tools like gulp or grunt . You can create assembly processes that will set a global variable or change a constant (for example, an API endpoint) and call them local testing (pointing your client to the stub server) and integration (for a real server).

Please note that you can easily integrate these build processes into Visual Studio , making them part of the global debug / build process.

Here it is a simple gulp task, useful for replacing text inside any file: https://www.npmjs.com/package/gulp-replace

+1
source

All Articles