Add a Python backend
Add Python routes with the @primate/python
module. Write routes in Python;
Primate compiles them to WebAssembly and wires them like JS routes.
Manage your Primate Python app as you would a normal Python project. Create a
venv
and use requirements.txt
to manage your dependencies to get a complete
LSP experience.$ npm install @primate/python
TypeScriptconfig/app.ts
import config from "primate/config";
import python from "@primate/python";
export default config({ modules: [python()] });
Pythonroutes/index.py
from primate import Route
@Route.get
def get(request):
return "Hello from Python"
@Route.post
def post(request):
return {"ok": True}