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.