55c36e0240
* Fix examples to work as expected * Clean up examples * Update worker test * Merge in from main and cleanup example
26 lines
514 B
Python
26 lines
514 B
Python
import os
|
|
import socket
|
|
|
|
from sanic import Sanic, response
|
|
|
|
|
|
app = Sanic(__name__)
|
|
|
|
|
|
@app.route("/test")
|
|
async def test(request):
|
|
return response.text("OK")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
server_address = "./uds_socket"
|
|
# Make sure the socket does not already exist
|
|
try:
|
|
os.unlink(server_address)
|
|
except OSError:
|
|
if os.path.exists(server_address):
|
|
raise
|
|
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
sock.bind(server_address)
|
|
app.run(sock=sock)
|