Apollo Rest DataSource

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

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

  • @AliOzanPiskin
    @AliOzanPiskin 6 лет назад +4

    Hey dude when will you stop? You never give up... Thank you so much, you are impressive!

    • @bawad
      @bawad  6 лет назад +4

      😂😂, I have no plans to stop anytime soon :)

    • @CoryTheSimmons
      @CoryTheSimmons 6 лет назад +2

      Good! Love the stack you teach.

    • @stevereid636
      @stevereid636 6 лет назад +1

      This is why we should patron him so that he keeps going!

    • @bawad
      @bawad  6 лет назад

      :)

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

    In order to use the TTL your request has to look something like this:
    const response = await this.post('your_url', payload, {
    headers: headers,
    cacheOptions: { ttl: 300 }
    }
    I think this also work with a get request :)

  • @Softkkey
    @Softkkey 5 лет назад

    Hello, I want to know if fetch is possible to use on production? If not which one could be a better option to do this? And if will be possible a quick example of how to use and configure with Apollo please.
    Thank you beforehand

    • @bawad
      @bawad  5 лет назад +1

      I think fetch is good for production

  • @DrPanesar
    @DrPanesar 6 лет назад

    Hi Ben. I usually do as you described re setting up a redis cache that saves the rest call for 30 seconds which means you don’t hit the end point repeatedly. That works awesome. So using datasource for me only makes sense for multiple requests in single resolver but then it’s quite like dataloader. I’ll have to try it but don’t think I’ll use it much.

    • @bawad
      @bawad  6 лет назад

      yeah, I feel the same way

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

    What you are doing wrong is that you pass TTL as second parameter in the get method. That is where the body goes. you have to go like: this.get("", null, { cacheOptions: { ttl: 5 } }) The TTL should be in an object as third parameter to the GET/POST/PUT/PATCH/DELETE method.

  • @yazer79
    @yazer79 5 лет назад

    Is using rest as source slowing the request rather than using a database request directly at first request? Caching is very nice though

    • @bawad
      @bawad  5 лет назад

      yeah it will be faster if you talk directly to the db

  • @andresmontoya7852
    @andresmontoya7852 6 лет назад

    I didn't know about it! Thanks for shared. I have one question, it only works with rest apis based on Json? If I use something like soap or wsdl or a api rest using XML... It'll work?

    • @bawad
      @bawad  6 лет назад +1

      I'm not sure

    • @harshitpant3067
      @harshitpant3067 6 лет назад

      I guess you need to parse that response and then return it

  • @AbhishekKumar-mq1tt
    @AbhishekKumar-mq1tt 6 лет назад

    Thank u for this awesome video

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

    I'm getting that the data is undefined, and I've basically got the exact same thing as you set up :/ so strange

  • @rjsnh1522
    @rjsnh1522 5 лет назад

    how can i fetch data from elastic search. Please tell me

    • @bawad
      @bawad  5 лет назад

      you can use fetch

  • @nemethmik
    @nemethmik 6 лет назад

    Hmm, this could be a quite useful tool for systems integration projects for major corporations: Graph QL as a generic API hub for integrating multiple types of sources of data (SQL, NoSQL, OData, REST). Did you find a way to reuse the (JSON) type definitions of REST or NoSQL (Mongo/Mongoose, for example) when creating Graph QL schemata/types/IDL/API, whatever?

    • @bawad
      @bawad  6 лет назад

      I haven't tried reusing the types like that