-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b06f5a
commit 1b9371a
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-FileCopyrightText: 2024 Michał Pokusa | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
import socketpool | ||
import wifi | ||
|
||
from adafruit_httpserver import Server, Request, Response | ||
|
||
|
||
pool = socketpool.SocketPool(wifi.radio) | ||
server = Server( | ||
pool, | ||
root_path="/static", | ||
https=True, | ||
certfile="cert.pem", | ||
keyfile="key.pem", | ||
debug=True, | ||
) | ||
|
||
|
||
@server.route("/") | ||
def base(request: Request): | ||
""" | ||
Serve a default static plain text message. | ||
""" | ||
return Response(request, "Hello from the CircuitPython HTTPS Server!") | ||
|
||
|
||
server.serve_forever(str(wifi.radio.ipv4_address), 443) |