Build a Complete Async API in Golang (part 6 - Auth Middleware)

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025

ความคิดเห็น • 3

  • @prashlovessamosa
    @prashlovessamosa 6 ชั่วโมงที่ผ่านมา

    Thanks

  • @LynxIo-wr4ul
    @LynxIo-wr4ul 2 ชั่วโมงที่ผ่านมา

    Thank you very much. However, is there a better way to mark certain API as public instead of doing that prefix "/auth" thing?
    Just like in NestJS there's this @public decorator for public endpoints

    • @thedevtool
      @thedevtool  ชั่วโมงที่ผ่านมา +1

      @@LynxIo-wr4ul better is subjective, but you can do the same thing in Go by applying middleware individually to each handler. Either way works. Since I don’t have complex routing, I’m happy with just using the prefix.
      The middleware in this video is effectively a decorator (function that wraps another function).