Debian Codegraph @

testing/web-platform/tests/tools/wptserve/docs/server.rst

raw
1 Server
2 ======
3
4 Basic server classes and router.
5
6 The following example creates a server that serves static files from
7 the `files` subdirectory of the current directory and causes it to
8 run on port 8080 until it is killed::
9
10 from wptserve import server, handlers
11
12 httpd = server.WebTestHttpd(port=8080, doc_root="./files/",
13 routes=[("GET", "*", handlers.file_handler)])
14 httpd.start(block=True)
15
16 :mod:`Interface <wptserve.server>`
17 ----------------------------------
18
19 .. automodule:: wptserve.server
20 :members: