{% extends "base.html" %} {% block title %}Hooks{% endblock %} {% block content %}
Server-side hooks loaded from the hooks/ directory.
Changes require a server restart to take effect.
{{ hook.file.split('/')[-1] }}
{{ hook.file }}
Exported names
Create a .py file in the
hooks/ directory and restart the server.
# hooks/my_hooks.py
from app.fastcms_hooks_api import on_record_create
@on_record_create("posts")
async def handle_new_post(event):
print(f"New post: {'{'}event.record_id{'}'}")
Import path
from app.fastcms_hooks_api import on_record_create, on_record_update, on_record_delete, on_any_event
Event attributes
event.type event.collection_name
event.record_id event.data