Adafruit_CircuitPython_HTTP.../examples/httpserver_cpython.py
2024-01-28 22:54:51 +00:00

22 lines
440 B
Python

# SPDX-FileCopyrightText: 2024 Michał Pokusa
#
# SPDX-License-Identifier: Unlicense
import socket
from adafruit_httpserver import Server, Request, Response
pool = socket
server = Server(pool, "/static", debug=True)
@server.route("/")
def base(request: Request):
"""
Serve a default static plain text message.
"""
return Response(request, "Hello from the CircuitPython HTTP Server!")
server.serve_forever("0.0.0.0")