Despliega 1000+ apps y plantillas en un clic
Recetas listas para Wasmer.
/
Recetas listas para Wasmer.
FastAPI Wasmer Starter template
This example shows how to run a minimal FastAPI app on Wasmer Edge.
https://fastapi-template.wasmer.app/
Your FastAPI application exposes a module-level ASGI application named app in main.py:
# main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
Key points:
app variable is the ASGI application that Wasmer Edge runs (e.g., main:app).GET / route returns JSON: {"message": "Hello World"}.python main.py), it serves via Uvicorn on port 8000.This example uses ASGI with FastAPI to handle requests on Wasmer Edge.
Choose one of the following:
# Option 1: Run the file directly (uses the __main__ block)
python main.py
# Option 2: Use uvicorn explicitly
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
Your FastAPI application is now available at http://localhost:8000.
GET / → returns:
{ "message": "Hello World" }
main:app.https://<your-subdomain>.wasmer.app/ to test.Tip: Keep the app entrypoint as
main:app(module:variable) so the platform can discover it easily.