How to build an API Gateway in ASP.NET Core using Ocelot (Build API Gateway in a few minutes)

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024
  • НаукаНаука

Комментарии • 143

  • @ramsys9906
    @ramsys9906 4 года назад +1

    Superb Presentation. What I like the most was the "style" in which you presented.... crystal crisp clear voice, no high or low pitch in your voice, going at constant steady speed, up to the point explaining each step properly, no shuffling from one screen to another (its very irritating) which makes to loose link. Looks like you have taken pains to plan your presentation well in advance keep up with the good work.

  • @pt_trainer9244
    @pt_trainer9244 5 месяцев назад

    Very concise tutorial, thank you.
    I added a Middleware in my individual services to check for a specific header that I only set at the gateway level so that clients cant call my microservice endpoints directly, but only through the gateway.
    Is there a better way to handle this for local dev. (Not using NSG in Cloud Service etc)

  • @umeshkushwaha01
    @umeshkushwaha01 2 года назад

    Very well explained. I appreciate your effort Nirjhar. It was honored to work with you.

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад

      @Umesh Kushwaha, thanks for watching! It was a pleasure to work with you as well!

  • @savithapn1790
    @savithapn1790 Год назад

    Great presentation , i like the way you explain any hard topic in a simple way so that anyone can understand, keep up the good work !

  • @nguyenminhat6594
    @nguyenminhat6594 4 года назад +2

    I'm beginning to learn Microservices. Thank you so much for this video. It's very helpful for me :D

  • @nagesh46s
    @nagesh46s 2 года назад +1

    Awesome explanation. Entire source code is also shared. Up voted. Keep up your good work sir.

  • @aweklin
    @aweklin Год назад

    Thanks a bunch for this video. It's now clearer to me how to use it.

  • @11shriji11
    @11shriji11 3 года назад +2

    Question: Can you please explain or extend this example with Kubernetes please? I found this helpful and I have implemented the same with Docker (docker desktop) but couldn't find much materials to extend in kubernetes.

  • @talhatariq5530
    @talhatariq5530 11 месяцев назад

    Greatly Explained! Kindly I request to Create a PlayList on API Gateways. Regards

  • @rajesh35hsp
    @rajesh35hsp Год назад

    to the point and precise. thank you for this.

  • @hannesbergsten1134
    @hannesbergsten1134 2 года назад

    Awsome video, I will try this tomorrow. Thanks alot!

  • @navaneethakrishnan1532
    @navaneethakrishnan1532 3 года назад

    Well Done....Nice Article....

  • @RameshKumar-gr1dt
    @RameshKumar-gr1dt 2 года назад

    Thank You Sir.. This is really great video.

  • @Mykhailo-r6h
    @Mykhailo-r6h Год назад

    that is amazing, thank you!

  • @govardhanm3703
    @govardhanm3703 2 года назад

    Good explanation Nirjhar, about the concepts.
    If possible share the related links in creating Authorization token (JWT) project in Description. Thanks.

  • @JulianRiverplate14
    @JulianRiverplate14 2 месяца назад

    Amazin video man!

  • @JustCode512
    @JustCode512 10 месяцев назад

    my rate 10/10 thanks man!

  • @pauldechampignon2287
    @pauldechampignon2287 2 года назад

    Amazing material. Thanks!

  • @sau002
    @sau002 2 года назад

    Nice demo. Thank you

  • @ahsannisar915
    @ahsannisar915 2 года назад

    Sir please tell me about, how to Take input multiple "Roles" for a single user as a input(login) in ocelot gateway.

  • @ravijsoni2477
    @ravijsoni2477 2 года назад

    Helpful. Thanks

  • @imoto8709
    @imoto8709 2 года назад

    sehr gut!

  • @alexreg78
    @alexreg78 3 года назад

    What is great in ocelot
    Prog never STOP)

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @МАЙК САХАРОВ, thanks for watching! I am not sure I understood the question.

  • @niknik5293
    @niknik5293 2 года назад

    will the cache be logged out to the console? can't seem to tell if the responses are returned from the cache or not in a POC app

  • @mahendranchinnaiah7593
    @mahendranchinnaiah7593 4 года назад +2

    Great Job.. I like to watch all of your videos. Please try some concepts in cloud environment(AWS,Azure)

  • @thomasjohanson6446
    @thomasjohanson6446 25 дней назад

    how can we implement gateway for multiple environments

  • @FurqanaFathuzzaman
    @FurqanaFathuzzaman 4 года назад +3

    This is an awesome video!
    I have a question, though. Where or how the gateway find the authentication server? I didn't see you state the address (localhost:5030) anywhere

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Furqana Fathuzzaman, I used one of the auth servers I created in one of my previous videos for auth demo here: ruclips.net/video/vWkPdurauaA/видео.html

    • @FurqanaFathuzzaman
      @FurqanaFathuzzaman 4 года назад +1

      @@DotNetCoreCentral
      I mean, how does the gateway (or other service) find the auth service? IIRC some example in the past state the auth service url in jwt authority or issuer, but I didn't see it being configured here. Does it have some technique to automatically find it?
      In the auth demo video, the api and auth service is in the same project/url, so I don't think it was needed. But in this one, the service is on different address (different port).
      Sorry if I missed something, I'm still grasping around the concept of separated identity service for microservice.

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @@FurqanaFathuzzaman In this example I am using JWT Authentication token, hence I am not calling back to the Identity server to find out what the user's identity. As for JWT Token, the user information is inside of the token in encoded format. Let me know if it makes sense. And as you can see in 05:20, I am passing the same secret key as in the authentication server, hence I am able to validate the token from here.

    • @aumidbek
      @aumidbek 3 года назад

      @@FurqanaFathuzzaman I don't understand this moment too. How to solve this?

    • @brienfoaboutanything9037
      @brienfoaboutanything9037 2 года назад

      Thats amazing information about Ocelot: ruclips.net/video/oAij1Ntt5Ps/видео.html

  • @sreedharcb3120
    @sreedharcb3120 3 года назад +1

    great video!, explained in simple steps. Thank you :)

  • @amitbajaj1995
    @amitbajaj1995 Год назад

    Hi, Which Opensource API gateway would you recommend for heavy load , several applications and microservices. ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  Год назад

      I have used Ocelot in prod with heavy load, have not seen any issues.

  • @dev4g276
    @dev4g276 2 года назад

    plaease create on video on authentication and authoraization in microservices

  • @manuelguerrero9917
    @manuelguerrero9917 3 года назад

    Super helpful video as always, I have a question about cache.
    Cache is going to return the same result from memory even though the data in the Microservices changed ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад +1

      @Manuel Guerrero, thanks for watching!
      To answer your question, yes, the cache will return data from the cache irrespective of changes in the microservice as long as the cache is not expired.
      And that is why it is important to cache items which make sense even if the data is a little stale based on business requirement.
      Most of the time, report type of data would make sense to cache, not something like product inventory.

    • @naval207
      @naval207 3 года назад

      @@DotNetCoreCentral If data is changed in microservices you have to fie the even and clear the cache in memory. memory service should be listen the event and clear the data.

    • @naval207
      @naval207 3 года назад

      You have to push the event when any changes happened in microservice , subscribe that even at memory cache

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@naval207 I am not sure I understand what you are trying to conclude here. As I mentioned earlier, the only thing we should be caching is, and I quote "And that is why it is important to cache items which make sense even if the data is a little stale based on business requirement.
      Most of the time, report type of data would make sense to cache, not something like product inventory."
      Again Ocelot is not a caching solution, the caching feature it provides should only be used for some convenience not for full-fledged caching, for that we should use distributed cache like Redis.

  • @MobileEpics
    @MobileEpics 2 года назад

    how did you get the JWT token that is used in Postman???

  • @amanjotsingh6232
    @amanjotsingh6232 2 года назад

    hello sir, can we access two different microservices which are present in different solutions using ocelot,if yes plz tell me how, if not then plz tell me the alternative to do this

  • @channing9705
    @channing9705 4 года назад +1

    Thanks for the video ! Actually the keys are different in two videos ("This is my test key" vs. "Thisismytestprivatekey"), maybe that's why some people fail the test :D

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Channing, thanks for watching! I think I changed the key while some testing, thanks for the catch.

  • @arkadiyshuvaev
    @arkadiyshuvaev 3 года назад

    Hello everybody. It seems to me that Ocelot has stopped developing since December 2020. Has anybody started looking for a substitute for Ocelot?
    What service can do request aggregation?
    Thank you in advance.

  • @tomfanara3743
    @tomfanara3743 3 года назад

    Hello Sir, Great videos and very clear! Do you have a simple Ocelot api gateway in docker compose? I'm having difficulty with the routings for a single GET service!

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @
      Tom Fanara, thanks for watching!
      I have used the standard docker image for .NET Core 3.1 and .NET 5 and that worked for me.

  • @RAM-ff8dy
    @RAM-ff8dy 4 года назад

    I always wait for your videos.,,great stuff..Really appreciate all your efforts..waiting for videos on Azure service bus, Azure Functuons,Azure MessageQueueing,Azure App Insights...etc

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @RAM, I will start with AWS as I work on AWS every day, will do Azure as well alongside.

    • @randomphilic27
      @randomphilic27 3 года назад

      @@DotNetCoreCentral pls if made can u give the exact link?

  • @chiragtank6359
    @chiragtank6359 2 года назад

    is there required to impement AddAuthentication in every micro service startup class file for auhorization ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад

      If you add it to the API Gateway, the individual microservices do not need to have authentication. But you will have to make sure the microservices are not accessible to the internet, meaning they are inside of a DMZ.

  • @kalyankumarsubramaniyan6405
    @kalyankumarsubramaniyan6405 4 года назад

    thank you very much for your video. Please do a video for certificate based authentication

  • @gopalakrishnanm9349
    @gopalakrishnanm9349 4 года назад +2

    pls put a video for consul with swagger in ocelot

  • @duongtuandat84
    @duongtuandat84 2 года назад

    As I understand, now all API call will go through Ocelot, so does it make slow or bottle-neck the transactions?

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад +1

      It will not if it is scaled properly, though it will introduce single-digit milliseconds latency, but that will be the case of any gateway.

  • @computerprogrammingadvance2612
    @computerprogrammingadvance2612 2 года назад

    Thanks

  • @ashokb3648
    @ashokb3648 3 года назад

    👍Awesome👏

  • @MrRavikishore2222
    @MrRavikishore2222 4 года назад

    I want to implement Active Directory authentication in Gateway. Can you please one more Video or any sample code .

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Ravi Kishore, I have not done anything with active directory authentication before. I will take a look and see if I can find something that might help you. Thanks

  • @28687451
    @28687451 3 года назад

    awesome videos hey can u tell me where u have specified auth servers in this video i tried the same watching you both video but getting error of badgateway 502

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Sagar Shah, thanks for watching! I am not using any authentication mechanism in this app. I built an open API. Bad gateway might be because the API Gateway do not have access to the Lambda, I mentioned that during this video, and it really is done out of box by the API gateway.

    • @28687451
      @28687451 3 года назад

      @@DotNetCoreCentral can u send me the link in which u have created open api?

  • @AbhinavSingh-ov7pj
    @AbhinavSingh-ov7pj 3 года назад

    Here we are using token from existing app and passing to ocelot api.but in real world the ocelot api should expose something so that valid user can generate token right ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Abhinav Singh, in real life as well the operation will be similar. The responsibility of the token provider is completely isolated from the API Gateway and it should be served by a third-party server. Which can be any of the cloud token providers or one of your own. API Gateway should not be in the business of providing tokens.
      That is the architectural principle I use.

    • @AbhinavSingh-ov7pj
      @AbhinavSingh-ov7pj 3 года назад

      @@DotNetCoreCentral so first time when user will call ocelote api ,user will send login credential to api.Then ocelote api will route to another service( token provider) whose route is configured in ocelote api.now if credential are fine then token will be returned which will use by user for successive call.my understanding is correct ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@AbhinavSingh-ov7pj yes!

  • @indranilbaidya7730
    @indranilbaidya7730 4 года назад

    What will b the url, after hoisting api gateway on iis ? N I'm not using jwt, I'm using owin. How can I configure owin on apigateway ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Indranil Baidya, the URL in IIS will be based on whatever virtual directory you are creating it inside. I do not think Ocelot supports anything below .Net Core 3.1 based on what I have seen its project configuration here: github.com/ThreeMammals/Ocelot/blob/master/src/Ocelot/Ocelot.csproj

  • @AmanGupta-fq5oq
    @AmanGupta-fq5oq 3 года назад

    Hi, could you please tell me how to route an action posting a json body please

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Aman Gupta, routing POST, GET, DELETE, PUT all are done the same way. There is no fundamental difference between HTTP method types when it comes to Ocelot API Gateway.

  • @indranilbaidya7730
    @indranilbaidya7730 3 года назад

    I've used owin oauthauthorizationserveroption, oauthbearertoken. Plz guide me how can I use it in ocelot ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад +1

      @Indranil Baidya, thanks for watching! I will try out owin with Ocelot and will let you know.

    • @indranilbaidya7730
      @indranilbaidya7730 3 года назад

      @@DotNetCoreCentral That will be very help full.
      Waiting .......

    • @indranilbaidya7730
      @indranilbaidya7730 3 года назад

      @@DotNetCoreCentral Any update on this ? Please let me know.

  • @bloodeyhell7026
    @bloodeyhell7026 4 года назад

    Can you make a video on service discovery

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Da Prodigy, I surely can. I will put it on my calendar. Thanks for the suggestions.

  • @muhammeda1426
    @muhammeda1426 3 года назад

    Do we have to request id like customer/1
    Or can we request like customer?customerid=1
    İf we can how?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @M A, for query string parameters nothing specific needs to happen, as long as the base path is configured, whatever is in query string will be passed along.

    • @muhammeda1426
      @muhammeda1426 3 года назад

      @@DotNetCoreCentral it worked thanks for answer

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@muhammeda1426 welcome!

  • @manasupadhyay8101
    @manasupadhyay8101 3 года назад

    Hey I have made the same API gateway and deployed it to Azure aks and it's not working

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Manas Upadhyay, can you give a little bit more details, what error you see in the container logs etc.

    • @manasupadhyay8101
      @manasupadhyay8101 3 года назад

      @@DotNetCoreCentral Ocelot.Responder.Middleware.ResponderMiddleware[0]
      requestId: 0HMACAC3LH4O0:00000002, previousRequestId: no previous request id, message: Error Code: RequestCanceled Message: The operation was canceled. errors found in ResponderMiddleware. Setting error response for request path:/gateway/claim, request method: GET

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@manasupadhyay8101 the error says there is an issue with the configuration, can you share the ocelot configuration

    • @lismai9906
      @lismai9906 3 года назад

      I had to figure this out myself because in your video it was not mentioned how to get authentication to work - Token Server's secret key string MUST match with ocelot.demo project in order to properly authenticate and successfully get the external api

  • @JustScrolling123
    @JustScrolling123 3 года назад

    Hello, where is the video of JWT server implementation

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Иван Вангелов, here is the URL of JWT implementation: ruclips.net/video/vWkPdurauaA/видео.html

    • @JustScrolling123
      @JustScrolling123 3 года назад

      @@DotNetCoreCentral Thank you :)

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@JustScrolling123 welcome!

  • @parthvohra5891
    @parthvohra5891 4 года назад

    how did you got data from api/weather ? where is weather data file ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Parth Vohra, I created a new WEB API project in ASP.NET Core 3.1 as a part of the video, when you create a new Web API project, by default it comes with a weather controller. The data comes from an in-memory data structure. Hope this answers your question. Thanks for watching!

  • @shuhaib864
    @shuhaib864 4 года назад

    Thanks 🙏

  • @h.r134
    @h.r134 3 года назад

    Can i use nodejs service when i use Ocelot?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Hr, the service Ocelot forwarding the request can be anything. But Ocelot itself needs to be hosted in a .NET Core server.

    • @h.r134
      @h.r134 3 года назад

      @@DotNetCoreCentral thanks 🙏

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @@h.r134 you are welcome!

  • @arjaygregorio2019
    @arjaygregorio2019 3 года назад

    Hi! New here! I would like to know if is it possible that ocelot api gateway to host it into windows 2016 server type?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Arjay Gregorio, thanks for watching. Yes it is possible to host anywhere, as long as you can run a .NET Core application.

  • @muhammadandikakurniawan7037
    @muhammadandikakurniawan7037 4 года назад

    excuse me, i wanna ask about how to implement action filter for ocelot ?, for loging, thankyou

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @Muhammad andika Kurniawan, Ocelot out of box comes with comprehensive logging. What extra are you planning to log?

    • @muhammadandikakurniawan7037
      @muhammadandikakurniawan7037 4 года назад

      @@DotNetCoreCentral i wanna log pre and after endpoint executed like use action filter, but i try setup my filter and it's no work for endpoint that registered in ocelot.json, only work for api that created in project :)

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад

      @@muhammadandikakurniawan7037 A middleware should work in that case. If you are facing any issues with that, if you can share the code in Github, I can take a look.

  • @johnkuriakose88
    @johnkuriakose88 3 года назад

    Hi, Your video is very helpful.
    Can I implement Api gateway with Old aspnet.mvc web app. Do i need to separate the view from the MVC controller. How would that work. All the documents I see says that the view should be calling the Gateway that would mean that i will have write a lot of code.
    Do you know if there is another way.

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @John Kuriakose, thanks for watching!
      To be honest, API Gateway is not meant for something like the MVC app. It is meant for API, so if you are exposing RESTful API through MVC then you should use API Gateway with it.
      Let me know if it makes sense.

  • @hanm
    @hanm 3 года назад

    Envoy please

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Ha Nguyen, thanks for watching! I will definitely look into Envoy.

  • @tplummer217
    @tplummer217 2 года назад

    Shouldn’t you always validate your audience?