2021-12-24 00:30:27 +02:00
|
|
|
from sanic import Sanic, response
|
2017-04-06 19:42:05 +00:00
|
|
|
|
|
|
|
|
2021-12-24 00:30:27 +02:00
|
|
|
app = Sanic("Example")
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/")
|
2017-04-06 19:42:05 +00:00
|
|
|
def handle_request(request):
|
2021-12-24 00:30:27 +02:00
|
|
|
return response.redirect("/redirect")
|
2017-06-01 11:53:05 -07:00
|
|
|
|
|
|
|
|
2021-12-24 00:30:27 +02:00
|
|
|
@app.route("/redirect")
|
2017-04-06 19:42:05 +00:00
|
|
|
async def test(request):
|
|
|
|
return response.json({"Redirected": True})
|
|
|
|
|
|
|
|
|
2021-12-24 00:30:27 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
app.run(host="0.0.0.0", port=8000)
|