useReply

Returns the core Fastify reply object, only available in SSR.

import { useReply } from 'fastify-vite-vue/server'
import { useReply } from 'fastify-vite-react/server'
const reply = useReply()

For convenience, here's the API reference taken from the official Fastify documentation:

code(statusCode)sets the HTTP status code.
statusCodereads and sets the HTTP status code.
header(name, value)sets a response header.
headers(object)sets all the keys of the object as response headers.
getHeader(name)retrieve value of already set header.
getHeaders()gets a shallow copy of all current response headers.
removeHeader(key)remove the value of a previously set header.
hasHeader(name)determine if a header has been set.
type(value)sets the `Content-Type` header.
redirect([code,] dest)redirect to the specified url, the status code is optional (defaults to `302`).
callNotFound()Invokes the custom not found handler.
serialize(payload)Serializes the specified payload using the default JSON serializer or using the custom serializer (if one is set) and returns the serialized payload.
serializer(function)Sets a custom serializer for the payload.
send(payload)Sends the payload to the user, could be a plain text, a buffer, JSON, stream, or an Error object.
sentA boolean value that you can use if you need to know if send has already been called.
rawThe [http.ServerResponse](https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_class_http_serverresponse) from Node core.
logThe logger instance of the incoming request.
requestThe incoming request.
contextaccess to the request's [context property](https://www.fastify.io/docs/latest/Request#Request).

This reference is also included in useHydration's return object as reply.