-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathhttps.py
More file actions
18 lines (16 loc) · 520 Bytes
/
https.py
File metadata and controls
18 lines (16 loc) · 520 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from socketify import App, AppOptions
app = App(
AppOptions(
key_file_name="./misc/key.pem",
cert_file_name="./misc/cert.pem",
passphrase="1234",
)
)
app.get("/", lambda res, req: res.end("Hello World socketify from Python!"))
app.listen(
54321,
lambda config: print("Listening on port https://localhost:%d now\n" % config.port),
)
app.run()
# mkdir misc
# openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -passout pass:1234 -keyout ./misc/key.pem -out ./misc/cert.pem