From 413154288d8403f6e1a4e85f855eb870a5fe6533 Mon Sep 17 00:00:00 2001 From: Rajeev Hegde Date: Fri, 15 Mar 2024 14:36:00 +0530 Subject: [PATCH] Update fastify.md --- packages/marko/docs/fastify.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/marko/docs/fastify.md b/packages/marko/docs/fastify.md index ec66d063a..8e0d02c6c 100644 --- a/packages/marko/docs/fastify.md +++ b/packages/marko/docs/fastify.md @@ -40,7 +40,16 @@ app.get("/", (request, reply) => { await fastify.listen(3000); ``` +### Global Outputs +We can add global outputs from the server side using the reply object or fastify instance. +```javascript +reply.locals.newProperty = 'Your value'; +``` +To use this in marko components we just need to refer out.global +```marko.js +$ const { newProperty } = out.global; +``` ### BYOB (Bring your own bundler) For the large portion of Marko's API a bundler is required. The example code above assumes that Marko templates can be loaded in your environment.