File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
- Simple file serving
1
+ Simple Test
2
2
-------------------
3
3
4
- Serving the content of index.html from the filesystem .
4
+ Serving a simple static text message .
5
5
6
- .. literalinclude :: ../examples/httpserver_simple_serve .py
7
- :caption: examples/httpserver_simple_serve .py
6
+ .. literalinclude :: ../examples/httpserver_simpletest .py
7
+ :caption: examples/httpserver_simpletest .py
8
8
:linenos:
9
9
10
10
If you want your code to do more than just serve web pages,
Original file line number Diff line number Diff line change 27
27
@server .route ("/" )
28
28
def base (request : HTTPRequest ):
29
29
"""
30
- Serve the default index.html file .
30
+ Serve a default static plain text message .
31
31
"""
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 )
34
35
35
36
36
37
print (f"Listening on http://{ wifi .radio .ipv4_address } :80" )
You can’t perform that action at this time.
0 commit comments