This example shows how to run a minimal Python standard-library HTTP server on Wasmer Edge.
https://<your-subdomain>.wasmer.app/ (deploy your own copy to get a live demo)
The server logic lives in src/main.py:
CustomHandlersubclasseshttp.server.SimpleHTTPRequestHandlerand overridesdo_GET()to return JSON:{"message": "Python app is running with Wasmer!"}.HTTPServer((host, port), CustomHandler)starts the server; by default it binds toHOST=127.0.0.1andPORT=8080, but both can be overridden via environment variables.- When run directly, the script prints the serving URL and blocks forever handling requests.
Because everything uses the Python standard library, no extra dependencies are required for Wasmer.
python src/main.pyYour server is available at http://127.0.0.1:8080/ (or whatever HOST/PORT you configure).
- Keep
src/main.pyas the entrypoint referenced inwasmer.tomlor your deploy command. - Deploy to Wasmer Edge.
- Visit
https://<your-subdomain>.wasmer.app/to confirm the JSON response.