Python interface for RHTTP server
Install the latest version of rhttp-python
with running installation command:
pip install rhttp-python
First you need to import required package:
# RHTTP server
from rhttp_python import RHTTPServer
First you need to create server by passing redis host and port:
server = RHTTPServer("127.0.0.1", 6379)
Then you can define endpoints using route
decorator
@server.route("/", "GET")
def home(req, res):
print(req)
return res.status(200).content_type("text/html").send("<h1>test</h1>")
First parameter of decorator is "path" of endpoint and second is http method
At the end you need run server:
server.listen()
This project is licensed under the terms of the MIT License. See the LICENSE file for details.