GraphQL vs REST?

default discord avatar
taun2160last year
2

Hi. I'm creating


1. A simple, minimal portfolio website with <10 products (no-eccommerce).


2. E-commerce website with hundreds of digital file downloads.



These are my first web dev projects and I don't know which data fetching/mutating approach I should be learning?



GraphQL branding is attractive, though is it necessary for these websites? Perhaps the Portfolio websites (a few products) I should be using REST, and GraphQL for the larger website?



Or for the sake of saving time, should I just get familiar with GraphQL and apply that for all projects? Or will GraphQL lead to more complexity/errors and therefore a longer dev time for the simple websites that don't require it?



I assume I should skip the Local API approach as that isn't relevant outside of Payload and GraphQL/REST will be more valuable for my portfolio, if I apply for jobs?



Or are all of these fetch methods quick and simple to learn and it's much of a muchness which one I use? I see a lot of questions related to GraphQL.

  • discord user avatar
    jmikrut
    last year

    honestly the only time i'd reach for GraphQL over REST is when it's

    needed


    we decided to use GraphQL for our own website to have fine-grained control over what data we receive from the CMS, so that we can keep the actual JSON from the CMS which is needed in the page to a minimum



    but even there, we probably got negligible benefits over REST and a LOT more complexity



    honestly i would go for REST most of the time until you absolutely need graphql



    and at that point, you could incrementally move over to GraphQL as needed

  • default discord avatar
    taun2160last year

    Ok cool, thanks!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.