response
- HTTP Response Object
- Type:
PagesResponse
- Description: The
response
object provides methods to control the HTTP response in a framework-agnostic way. This abstraction ensures your templates remain compatible across PocketBase versions.
Methods
file(path: string)
Serves a file from the filesystem.
write(s: string)
Writes a string directly to the response body.
redirect(path: string, status?: number)
Redirects to another URL, optionally specifying a status code.
json(status: number, data: any)
Sends a JSON response with the specified status code.
html(status: number, data: string)
Sends an HTML response with the specified status code.