How to set default route in Ocelot

113 Views Asked by At

I have created a separate ASP.NET Core Web API using Ocelot. The project will act as API gateway for other services.

What should be the configuration to call controllers (action methods) in API gateway project itself.

The above mentioned need arises when the project is hosted in Docker. I wanted to check if its hosted correctly so I tried to hit https://localhost:7143/api/index Or https://localhost:6001/api/index but it didn't work.

{
  "Routes": [      
    {
      "DownstreamPathTemplate": "/api/Category/add",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 9100
        }
      ],
      "UpstreamPathTemplate": "/api/category/add",
      "UpstreamHttpMethod": [ "post" ],
      "AuthenticationOptions": {

        "AuthenticationProviderKey": "Bearer"
      }
    }
  ],
  "GlobalConfiguration": {
    "BaseURL": "https://localhost:6001"
  }
}

enter image description here

0

There are 0 best solutions below