Skip to content

Commit eb89ecf

Browse files
committed
Merge the simpletest example into simple_serve
1 parent 3aef113 commit eb89ecf

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

examples/httpserver_simple_serve.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
print("Connected to", ssid)
2222

2323
pool = socketpool.SocketPool(wifi.radio)
24-
server = HTTPServer(pool, "/static")
24+
server = HTTPServer(pool, "")
2525

2626

2727
@server.route("/")
2828
def base(request: HTTPRequest):
2929
"""
30-
Serve the default index.html file.
30+
Serve a default static plain text message.
3131
"""
32-
with HTTPResponse(request, content_type=MIMEType.TYPE_HTML) as response:
33-
response.send_file("index.html")
32+
with HTTPResponse(request, content_type=MIMEType.TYPE_TXT) as response:
33+
message = "Hello from the CircuitPython HTTPServer!"
34+
response.send(message)
3435

3536

3637
print(f"Listening on http://{wifi.radio.ipv4_address}:80")

examples/httpserver_simpletest.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)