title: Creating HTTP Server with API and listener for all API calls
body: <p>I'm facing with problem about creating HTTP server which has API on his side and also is able to listen all calls and log it.
  I want to create something like:
  Hub - server responsible for handle my window services which will registered, also communication logging between hub and nodes.
  Nodes - window services which working as Client, which executing some tasks and using Hub API are able to logging information about that.</p>
  <p>I dont know it is possible to create HTTP server which include API and HTTPListener. I tried like that, but this wont work.</p>
  <p>Example:</p>
  <pre><code>static void Main(string[] args)
      {
          var httpServer = new HttpServer();
  
          httpServer.Start(); //Listener using address - http://localhost:8080 the same as SelfHostServer
  
          Console.WriteLine(&quot;Starting HTTP listener...&quot;);
  
          var config = new HttpSelfHostConfiguration(&quot;http://localhost:8080/&quot;);
  
          config.Routes.MapHttpRoute(
              &quot;API Default&quot;, 
              &quot;api/{controller}/{id}&quot;,
              new { id = RouteParameter.Optional });
  
          using (HttpSelfHostServer server = new HttpSelfHostServer(config))
          {
              server.OpenAsync().Wait();
              Console.WriteLine(&quot;Press Enter to quit.&quot;);
              Console.ReadLine();
          }
  
          while (Program._keepRunning) { }
  
          httpServer.Stop();
  
          Console.WriteLine(&quot;Exiting gracefully...&quot;);
      }
  </code></pre>
  <p>Im not sure Im going good way, maybe I should create a separate server to listen and a separate selfhost server for the API?
  Can someone explain what should I do for achive this? Thanks</p>
  <p>EDIT</p>
  <p>I want to avoid this:
  <a href="https://i.stack.imgur.com/HVyRH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HVyRH.png" alt="enter image description here" /></a></p>