Update fastify.md

This commit is contained in:
Rajeev Hegde 2024-03-15 14:36:00 +05:30 committed by Dylan Piercey
parent af4adcd1ee
commit 413154288d

View File

@ -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.