GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) πŸ’–

okay bestie, welcome to the Development section of the Golf manual, and no we are NOT skipping the lore, sit down, grab a boba πŸ§‹


✨ NAME ✨

before-handler β€” the (service-processing) queen who runs your code before anything else gets handled πŸ‘‘


🎯 PURPOSE 🎯

Run your code before a request gets handled. That's it. That's the whole job. It's giving opening act energy 🎀


πŸ“ SYNTAX πŸ“

before-handler
...
end-before-handler

πŸ’… DESCRIPTION πŸ’…

So here's the tea, fr fr: every single Golf request rolls through a request dispatcher (peep request() for that one), and that dispatcher? Auto-generated. Not your problem. Slay.

Now if you wanna drop your own code in to run before a request gets handled, you make a source file called before-handler.golf and write code that starts with before-handler and ends with end-before-handler. Golf will literally just pick it up on its own and compile it with your application. No wiring, no config, no drama. Obsessed πŸ’–

🫢 heads up bestie: if no request executes β€” like, say, your app just doesn't handle a given request β€” then the before-handler handler does not execute either. It's not gonna fire into the void, okay? It knows its moment.

🌸 EXAMPLES 🌸

Here's a lil baby implementation of the before-handler handler that literally just outputs "Getting Started!!" because sometimes that's all you need πŸŽ€

before-handler
    @Getting Started!!
end-before-handler

iconic. ate. no notes. ✨


πŸ” SEE ALSO πŸ”

  • Service processing
  • after-handler
  • before-handler
  • begin-handler
  • call-handler
  • See all documentation

that's the whole page bestie, go forth and run things before things πŸ’œ

Version $VERSION, dated $DATE β€” and yes, GOLF(2gg), the one and only πŸ¦‹βœ¨

πŸ“¦ where this page comes from