All examples are located in the examples
directory.
hello_world.py
- Basic HTTP server setuphello_world_cli.py
- Command-line interface examplehello_world_cli_ws.py
- CLI with WebSocket supporthello_world_unix_domain.py
- Unix domain socket examplehttps.py
- HTTPS server with SSL/TLS configurationwebsockets.py
- Basic WebSocket implementationws_close_connection.py
- WebSocket connection managementchat/
- Real-time chat applicationbroadcast.py
- Broadcasting messages to multiple clientsbackpressure.py
- Handling WebSocket backpressuremiddleware.py
- Basic middleware implementationmiddleware_async.py
- Asynchronous middlewaremiddleware_sync.py
- Synchronous middlewaremiddleware_router.py
- Router-based middlewarerouter_and_basics.py
- Routing fundamentalsasync.py
- Asynchronous request handlingupgrade.py
- Protocol upgrade examplesupgrade_async.py
- Asynchronous protocol upgradesstatic_files.py
- Serving static filesfile_stream.py
- File streaming capabilitiesupload_or_post.py
- File uploads and POST data handlingtemplate_jinja2.py
- Jinja2 template integrationtemplate_mako.py
- Mako template integrationtemplates/
- Template examples and resourcescustom_json_serializer.py
- Custom JSON serializationhttp_request_cache.py
- HTTP request cachingproxy.py
- Proxy server implementationautomatic_port_selection.py
- Dynamic port selectionlisten_options.py
- Server listening optionsgraceful_shutdown.py
- Graceful server shutdownforks.py
- Multi-process server setupgraphiql.py
- GraphiQL interface setupgraphiql_raw.py
- Raw GraphQL implementationdocker/
- Docker containerization examplesrequirements.txt
- Example dependencieserror_handler.py
- Error handling strategiesbetter_logging.py
- Advanced logging setupnot_found.py
- Custom 404 error pageshelpers/
- Utility functions and helper modules