Skip to content

Astrojarred/issue15#16

Merged
astrojarred merged 5 commits into
mainfrom
astrojarred/issue15
Jun 21, 2026
Merged

Astrojarred/issue15#16
astrojarred merged 5 commits into
mainfrom
astrojarred/issue15

Conversation

@astrojarred

Copy link
Copy Markdown
Owner

Closes #15.

We can now write SvelteKit server load functions in Python (+page.server.py and +layout.server.py)

  • SvelteKit still runs load on the Node side, but the .py file gets turned into a thin JS shim that POSTs to a Python endpoint (/api/_load/...)
  • No extra Python package for users to install — the runtime ships with the plugin and gets copied into the function bundle at build time.

Included:

  • Return normal page/layout data from async def load(event)
  • Use event.params, event.url, event.route, event.parent, event.data, event.cookies
  • errors: return ("error", 404, "Not found")
  • redirects: return ("redirect", 307, "/somewhere")
    Or call error(...) / redirect(...) with no import — they get injected when your module runs

@astrojarred astrojarred merged commit 53c34c5 into main Jun 21, 2026
2 checks passed
@astrojarred astrojarred deleted the astrojarred/issue15 branch June 21, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add loading functions

1 participant