Skip to content

This repository contains simple samples demonstrating the use of Ocelot to build an API Gateway in .NET. Explore the provided examples to learn how to leverage Ocelot for routing and aggregation in your microservices architecture.

License

Notifications You must be signed in to change notification settings

hsjalilian/Ocelot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Table of Contents
  1. Ocelot API Gateway
  2. What Is an API Gateway?
  3. What Is Ocelot
  4. Features
  5. How to install
  6. Roadmap
  7. Sample Projects

Ocelot API Gateway

This repository contains some samples that show ocelot features in different projects from basic to advance config.

What Is an API Gateway?

An API gateway is an API management tool that sits between a client and a collection of backend services.

An API gateway acts as a reverse proxy to accept all application programming interface (API) calls, aggregate the various services required to fulfill them, and return the appropriate result.

Benefits of API gateways

  • Security
  • API authentication
  • Input validation
  • Filtering
  • Faster response times
  • load balancing
  • Rate limiting
  • Expose only one endpoint
  • Billing for microservices
  • caching
  • Monitoring and tracking
  • Extending legacy apps

What Is Ocelot

Ocelot is a .NET API Gateway. This project is aimed at people using .NET running a micro services/service-oriented architecture that needs a unified point of entry into their system. However, it will work with anything that speaks HTTP and run on any platform that ASP.NET Core supports.

Features

For a quick list of Ocelot's capabilities for more information see the documentation.

  • Routing
  • Request Aggregation
  • Service Discovery with Consul & Eureka
  • Service Fabric
  • Kubernetes
  • WebSockets
  • Authentication
  • Authorization
  • Rate Limiting
  • Caching
  • Retry policies / QoS
  • Load Balancing
  • Logging / Tracing / Correlation
  • Headers / Method / Query String / Claims Transformation
  • Custom Middleware / Delegating Handlers
  • Configuration / Administration REST API
  • Platform / Cloud Agnostic

How to install

Ocelot is designed to work with ASP.NET and it targets net6.0.

Install Ocelot and it's dependencies using NuGet.

Install-Package Ocelot

Or via the .NET Core CLI:

dotnet add package ocelot

All versions can be found here

Sample Projects

Basic

The simplest sample that introduces how to use Ocelot here.

Link here : Basic

Multi Services

Same as the Basic template but routes requests to multi services.

Link here : Mulit Services

Request Aggregation

In this project, receive request and collect response from two different services.

Link here : Request Aggregation

Logging

In this project, use Serilog for log all request in file.

Link here : Logging

Authentication And Authorization

In this project, handle authentication and authorization with JWT Token.

Link here : Authentication And Authorization

RateLimit

In this project, handle client request limitation in custom periodic time per endpoint.

Link here : RateLimit

Caching

In this project, use CacheManager for caching output response.

Link here : Caching

Load Balance

In this project, Balance request to multi same service.

Link here : Load Balance

Swagger

In this project, Enable Swagger for APIs.

Link here : Swagger

Qos

In this project, Enable circuit breaker.

Link here : QoS

About

This repository contains simple samples demonstrating the use of Ocelot to build an API Gateway in .NET. Explore the provided examples to learn how to leverage Ocelot for routing and aggregation in your microservices architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages