GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) β€” after-handler πŸ’–

okay bestie, welcome to the Golf manual, section 2gg, and this one is literally the after-party of your request lifecycle. no cap. πŸŽ€


✨ NAME ✨

after-handler β€” it's giving (service-processing) πŸ¦‹


🌸 PURPOSE 🌸

Run your code after a request gets handled. that's it, that's the whole vibe. periodt. πŸ’…


⭐ SYNTAX ⭐

after-handler
...
end-after-handler

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, bestie πŸ«– β€” every single Golf request rolls through a request dispatcher (go peek at request(), iykyk). and if you wanna say "hey, run my code after a request is handled", you do it like this:

  • make a source file called after-handler.golf πŸ“
  • implement a handler that starts with after-handler and ends with end-after-handler
  • and boom πŸ’₯ β€” it gets automatically picked up and compiled with your application. no wiring, no setup, it just knows. main character energy fr fr.

now for the fine print, and this part matters:

if no request executes β€” like, say your app just doesn't handle a given request β€” then the after-handler handler does not execute either. sad but true 😭
BUT 🚨 if you use exit-handler to exit the current request handling, the after-handler handler still executes. the after-party goes on, babe. πŸ”₯

🌈 EXAMPLES 🌈

here's a lil baby implementation of an after-handler handler that just outputs "Hi there!!" β€” adorable, iconic, no notes ✨:

after-handler
     @Hi there!!
end-after-handler

🧚 SEE ALSO 🧚

  • Service processing πŸ’œ
  • after-handler
  • before-handler
  • begin-handler
  • call-handler
  • See all documentation πŸ“š

and that's a wrap on GOLF(2gg), bestie!! this page was served up by $VERSION, dated $DATE β€” go forth and handle your requests after everything else, slay πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from