项目作者: basarburak

项目描述 :
Ocelot Api Gateway with Api version simple example
高级语言: C#
项目地址: git://github.com/basarburak/NetCore-ApiGateway.git
创建时间: 2019-06-11T22:13:25Z
项目社区:https://github.com/basarburak/NetCore-ApiGateway

开源协议:

下载


NetCore-ApiGateway

#Product Api

/localhost:5000/api/v1.0/category

/localhost:5000/api/v2.0/category

  1. [ApiVersion("1.0")]
  2. [ApiController]
  3. [Route("api/v{version:apiVersion}/[controller]")]
  4. public class CategoryController : ControllerBase

#Ocelot Api Gateway

/localhost:9000/v1/category

/localhost:9000/v2/category

  1. "ReRoutes": [
  2. {
  3. "DownstreamPathTemplate": "/api/{version}/category",
  4. "UpstreamPathTemplate": "/{version}/category",
  5. "UpstreamHttpMethod": [
  6. "Get"
  7. ],
  8. "DownstreamScheme": "http",
  9. "DownstreamHostAndPorts": [
  10. {
  11. "Host": "localhost",
  12. "Port": 5000
  13. }
  14. ]
  15. }
  16. ]