GOLF(2gg)
π 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-handlerbefore-handlerbegin-handlercall-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
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms