2022-05-31 22:46:51 +00:00
|
|
|
from socketify import App, AppOptions
|
|
|
|
|
2022-11-16 19:28:46 +00:00
|
|
|
app = App(
|
|
|
|
AppOptions(
|
|
|
|
key_file_name="./misc/key.pem",
|
|
|
|
cert_file_name="./misc/cert.pem",
|
|
|
|
passphrase="1234",
|
|
|
|
)
|
|
|
|
)
|
2022-05-31 22:46:51 +00:00
|
|
|
app.get("/", lambda res, req: res.end("Hello World socketify from Python!"))
|
2022-11-16 19:28:46 +00:00
|
|
|
app.listen(
|
2023-01-21 16:43:48 +00:00
|
|
|
54321,
|
2022-11-16 19:28:46 +00:00
|
|
|
lambda config: print("Listening on port https://localhost:%d now\n" % config.port),
|
|
|
|
)
|
2022-10-24 17:15:46 +00:00
|
|
|
app.run()
|
|
|
|
|
2023-01-21 16:43:48 +00:00
|
|
|
# mkdir misc
|
2022-11-16 19:28:46 +00:00
|
|
|
# openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -passout pass:1234 -keyout ./misc/key.pem -out ./misc/cert.pem
|