Exemplo n.º 1
0
def main():
    sock = http.Http('0.0.0.0', 3000)
    for req in loop.events():
        req.reply(
            [200, u"OK"],
            {u"Content-Type": b"text/html"},
            b"Hello World")
Exemplo n.º 2
0
def main():
    sock = http.Http('127.0.0.1', 3000)
    #rconn = redis.Redis(unix_socket_path="/work/target/redis.sock")
    rconn = redis.Redis(port=3001)
    for req in loop.events():
        n = rconn.incr("hello-world-counter")
        req.reply(
            [200, u"OK"],
            {u"Content-Type": b"text/html"},
            "Hello page opened {} times".format(n).encode('utf-8'))