Using a Laravel REST API with a NextJs App

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

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

  • @nadeemahmed7947
    @nadeemahmed7947 3 года назад +8

    Thank you, can you explain bit more about hosting backend and frontend app or make a separate tutorial for that?

  • @OnlyJavascript
    @OnlyJavascript 3 года назад +3

    perfect timing man...I needed it.

  • @shofada
    @shofada 3 года назад +14

    Well done. But to be “fair” 😀, kindly do one with NuxtJS. Pleeease!

    • @themsaid
      @themsaid 3 года назад +9

      I might :D

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

      I think next js is better one haha

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

      Okk Next

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

    Mohamed you have no idea how much this helped me
    Thank you 😭😁

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

      Glad it did 🙂

  • @madtin
    @madtin Год назад +2

    How one would avoid calling /user when the user is not logged in? It returns 401 unauthenticated but the call is being made for no reason... Cookie is always set even after logging out...

  •  3 года назад

    I really like that you did this, I want to try some new front end to replace livewire.

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

      y u want to replace livewire?

    •  2 года назад

      @@mansourmansour5841 is super slow with big datasets, this is not elixir phoenix

  • @IBeThieving
    @IBeThieving 2 года назад +2

    Why are is allowed_origins set to all? Surely this should be set to the domain? This could be a security risk

  • @pranayaryal
    @pranayaryal 10 месяцев назад +1

    One part missing in axios instance is add
    withXSRFToken: true
    This caused lot of headache

  • @daleryanaldover6545
    @daleryanaldover6545 3 года назад +9

    I read your article about external front end with laravel backend a few months back and it guided me in building a desktop app that connects to laravel api via session, the cookies are sent from backend to front end which is used to persist the user session. I also got a deep dive to Laravel authentication and implemented a login auth from the desktop app that authenticates using the database from backend, which is kinda confusing to setup at first. Anyway gotta try nextjs soon

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

      Nice! Glad you find my content useful :)

    • @SayaWRT
      @SayaWRT Год назад +1

      which article. can you provide the link?

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

    no dummy data anymore, very nice

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

    Great Tutorial, but can you explain in detail nuxt js and in to regard job in laravel

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

    Great Tutorial, on a side note, I really like you PhpStorm settings. Which theme do you use?

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

      Looks like Night owl

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

      It's called Night Owl

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

    Hello, why user variable is undefined? I've got the details for logged on user, but it can't assign to user variable

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

    Hello Bro! Should I need to run Laravel and NextJs in different ports? Or Laravel will manage internally ports?

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

    Nice tutorial, btw which theme and fonts do you use?

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

    I find this tutorial very helpful, however - in a "real" setup, you would probably utilize a HOC, in order to render the "loading" state, for e.g. pages with an auth middleware.
    Or authenticate server side, to prevent flickering.
    Do you have any plans for tutorials for either a HOC, or Authentication on the server?
    Cheers.

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

      What is hoc

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

      @@piusijachi2763 higher order component

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

    so where the token store it? as encrypt by nextjs to be cookie or store to local storage?

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

    I use this approach in a template, and it doesn't work. The useAuth method only runs once so the page is stuck at loading. I also did this in a clean project and it worked fine, because it runs multiple times. Anyone knows how why useAuth only runs once for my case?

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

    Respect from Pakistan 🇵🇰
    Hot topic much needed

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

    how to return these headers using cors config
    Access-Control-Allow-Headers
    Access-Control-Allow-Methods

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

    Not about Next, but about react: how come expressions like {errors.lenght && ..some.jsx...} evaluate in jsx being returned, instead of a Boolean?

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

    You do the same fetching using nuxt js. Thank you!

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

    I woke up pondering this approach and this tutorial was exactly the introduction I needed to assess feasibility, thank you so much! I'm curious about production deployment options. The Laravel blog has an article regarding Forge, but if I were to use Laravel Vapor for the backend, would I have to use Vercel (or similar, independently from Vapor) to deploy the NextJs app?

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

      Using Vercel or Netlify for hosting the NextJS app is the most common approach yes.

  • @user-tt6nc6mo7k
    @user-tt6nc6mo7k 2 года назад

    I get a "unable to verify the first certificate" error from my nextjs app if I try to use SSG or SSR. However, if I use CSR it works fine. How did you get yours to work with your valet provided certificates?

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

    is it possible to use Laravel as headless CMS to bypass CORS for same origin issue to distribute the API on tenant mode or different domain distribution ?

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

    Thanks for sharing great informtion

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

    Great video!

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

    What happen if authenticated user try to access register page?

  • @7ala9at
    @7ala9at 3 года назад

    thank u for this turorial, please any solve problem user unauthenticated in console log , sorry for my english 😀

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

    May i know any reason why you favor react over vue ?

    • @themsaid
      @themsaid 3 года назад +6

      My personal favorite is actually Vue with the options API. But I'm open to trying different tools and technologies all the time :)

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

    This is great stuff. Any suggestions how to deploy this on a LAMP server?

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

    Thanks

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

      You're welcome :)

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

    YOOOOOOOOOOOOOOOOOO