Building a GraphQL server in Next.js

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

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

  • @arsamsarabi
    @arsamsarabi 4 года назад +12

    THE best GraphQL tutorial video I've seen. Ever. Very well explained. Keep up the good work 👍🏻

  • @MrGreenpaulo
    @MrGreenpaulo 4 года назад +7

    Exactly what I needed for my project, thanks!

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

    You explained this really simply and succinctly but also with enough detail that the nuance of why you were doing things didn’t get lost. Thanks!

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

    Thanks for this great into to new Next js server graphql!
    I did run into an issue while following along but started with a typescript base in Next and not iust plain js. My graphql.js route created errors and would not come up. Here is the FIX:
    The fix was to use the common js "Require" syntax verses "Import" syntax. So at top of the graphql.js file (note I did not use the .ts extension following just your tutorial and plain js)
    The import as you illustrated " import ApolloServer, { gql } from "apollo-server-micro"; " did not work and deep errors.
    After much looking around I thought it may need the "Require" syntax instead. Trying " const { ApolloServer, gql } = require('apollo-server-micro'); " instead, to my surprise, it worked!
    Hope that helps anyone who has typescript installed in their Next JS. Look forward to more teaching from you!

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

      Nice! I found that,
      import { gql, ApolloServer } from "apollo-server-micro";
      also works for typescript next js :)

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

    I'm building a GraphQL app right now. Really helpful.

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

    Thanks, nice tutorial. What color theme you use? It's a nice theme.

  • @JamesQQuick
    @JamesQQuick 3 года назад +2

    Thanks!

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

    Thanks for the tutorial! I am encountering an issue with the deployment. It seems like vercel cannot get connected to the Heroku's postgresql
    20:47:54.795 Error: self signed certificate
    20:47:54.795 at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34)
    20:47:54.795 at TLSSocket.emit (events.js:315:20)
    20:47:54.795 at TLSSocket._finishInit (_tls_wrap.js:936:8)
    20:47:54.795 at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12)
    How do you do your deployment?

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

    This video was excellent, does anyone have any recommendations on how to add mutations to this project? like how would I post stuff to the server?

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

    shout out to Leigh for getting on LogRocket!

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

    Great video!
    How do you host this if you want NextJS on a CDN and the backend on some server?
    What vscode theme are you using?

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

    When deploying to Zeit (Vercel) it throws an error saying it has more than 12 serverless functions which is the limit per repository. is It right or am I missing something?

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

      Hey Evandro! Great question... it seems like Now has a limit of 12 serverless functions per deployment on a Hobby account (vercel.com/docs/v2/platform/limits#general-limits)... that said, I don't quite know what that means, so I started a question on their Spectrum channel to try to find out some additional details. Stay tuned to this page to see what they reply with: spectrum.chat/zeit/general/serverless-functions-per-deployment-limit~8172db36-096d-4ab1-a6de-2f3bf6893341

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

      reduce the number of files in pages folder, all files without "_" prefix are all public by default (included /pages, /pages/api). I move those files which doesn't need getInitialProps/getServerSideProps to folders outside of pages

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

    I'm using CRA and I have a backend directory where I setup my ApolloServer, PrismaClient and connect to my DB. On the frontend I just hooked up ApolloClient to my graphql endpoint and everything works. How would I go about using ApolloClient here with NextJS? Also, could I just move my backend directory into the root directory of my NextJS app?

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

    Excellent video. May i know if we can use apollo-server-express instead of apollo-server-micro? What's the difference between the two? Can i use type-graphql with them? Thanks

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

      apollo-server-micro is now deprecated. apollo-server is the plain GraphQL server Apollo is providing. apollo-server-express is used to integrate with your already existing express backend. But here API routes are in the NextJS server, so using that will be an overhead for the bundlesize

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

    soo will it work on apache server?

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

    Could you make a video on ApolloClient and NextJS please.

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

    Nice Please can you do for mongodb?

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

    Too small letters please zoom it

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

      bro you can increase it easily tough =). Hone you have done this amazing tutorial

  • @mumk
    @mumk 4 месяца назад

    javascript is so messy...

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

    Thanks!