github sparckles/Robyn v0.6.0
v0.6.0 Release | Major changes

latest releases: v0.72.2, v0.72.1, v0.72.0...
4 years ago

This release is made up of a few major changes:

  • We have now updated to pyo3 0.14
  • We can now serve static directories(i.e. host a react project)
  • A request object is now available to PUT, POST and PATCH
  • You can now add body in PUT, PATCH and DELETE
  • We have a hot reloading server now looking for changes in directory
  • We are now using actix as a base

Special Thanks to:

Example usage:

from robyn import Robyn, static_file, jsonify

app = Robyn(__file__)

callCount = 0


@app.get("/")
async def h():
    global callCount
    callCount += 1
    message = "Called " + str(callCount) + " times"
    return message

@app.get("/test")
async def test():
    import os
    path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "index.html"))
    return static_file(path)

@app.post("/jsonify")
async def json(request):
    return jsonify({"hello": "world"})

@app.post("/post")
async def postreq(request):
    return bytearray(request["body"]).decode("utf-8")

@app.put("/put")
async def putreq(request):
    return bytearray(request["body"]).decode("utf-8")

@app.delete("/delete")
async def deletereq(request):
    return bytearray(request["body"]).decode("utf-8")

@app.patch("/patch")
async def patchreq(request):
    return bytearray(request["body"]).decode("utf-8")

@app.get("/sleep")
async def sleeper():
    await asyncio.sleep(5)
    return "sleep function"


@app.get("/blocker")
def blocker():
    import time
    time.sleep(10)
    return "blocker function"


if __name__ == "__main__":
    app.add_header("server", "robyn")
    app.add_directory(route="/",directory_path="./test_dir/build", index_file="index.html")
    app.start(port=5000)

To enable hot reloading, use the following command:

python3 test.py --dev=true

Thank you for all the support during this release! Without the community, this would not be possible! ❤️ 🔥

Don't miss a new Robyn release

NewReleases is sending notifications on new releases.