NextJS APIs vs Server Actions

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

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

  • @ankitrai96
    @ankitrai96 10 месяцев назад +9

    Welcome to coding 101 by The Weekend.

    • @rasmic
      @rasmic  10 месяцев назад +2

      😂

  • @exodia_hosni
    @exodia_hosni 5 месяцев назад +1

    i know it's a stupid question but what's a webhook api what's the difference between webhook and normal apis like rest api i don't really get it

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

      I'd watch videos on it so u can full understand my g

  • @koolam5158
    @koolam5158 3 месяца назад

    many thanks!! 🙏🏻

  • @vinaciotm
    @vinaciotm 5 месяцев назад +1

    keep making videos about next. Thanks 🇧🇷

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

      More to come!

  • @cunningham.s_law
    @cunningham.s_law 27 дней назад

    do you still beleive actions are better than routes?
    I feel like they are harder to debug individually

  • @ShiNoBiize
    @ShiNoBiize 9 месяцев назад +1

    Hey Ras, I would like to know how you use server actions with a regular button (not in form) which fire a get/post function onClick :) for example you have an invitation page with a token and you can accept or decile the invitation, so you have 2 buttons "accept" and "deny" and these bottuns execute a server action function which writes to the DB the decision.

    • @rasmic
      @rasmic  9 месяцев назад

      Here's a piece of code, the deleteBeacon function is a server action
      onClick={async (e) => {
      e.preventDefault()
      try {
      const response = await deleteBeacon(info?.id)
      queryClient.invalidateQueries({ queryKey: ['get-beacons', user?.id!] })
      toast("Beacon deleted")
      router.refresh()
      return response
      } catch (error) {
      console.log('error')
      Sentry.captureException(error);
      toast("Deleting failed")
      return
      }

  • @jayantaggarwal4397
    @jayantaggarwal4397 7 месяцев назад

    is it feasible from deployment point of view to use server actions instead of api routes ? will it result in some sort of problems or not?

    • @rasmic
      @rasmic  7 месяцев назад

      there are some cons, will talk about in a video

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

    i think we are not supposed to fetch data using server actions.Right?

    • @rasmic
      @rasmic  5 месяцев назад +1

      we not!! check my updated videos