We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b06f5a commit 1b9371aCopy full SHA for 1b9371a
examples/httpserver_https.py
@@ -0,0 +1,30 @@
1
+# SPDX-FileCopyrightText: 2024 Michał Pokusa
2
+#
3
+# SPDX-License-Identifier: Unlicense
4
+
5
+import socketpool
6
+import wifi
7
8
+from adafruit_httpserver import Server, Request, Response
9
10
11
+pool = socketpool.SocketPool(wifi.radio)
12
+server = Server(
13
+ pool,
14
+ root_path="/static",
15
+ https=True,
16
+ certfile="cert.pem",
17
+ keyfile="key.pem",
18
+ debug=True,
19
+)
20
21
22
+@server.route("/")
23
+def base(request: Request):
24
+ """
25
+ Serve a default static plain text message.
26
27
+ return Response(request, "Hello from the CircuitPython HTTPS Server!")
28
29
30
+server.serve_forever(str(wifi.radio.ipv4_address), 443)
0 commit comments