Extensible API server
Project description
Murloc is an extensible API server.
To define API methods, use the route
decorator like so:
# main.py
from murloc import Murloc
app = Murloc()
@app.route("/hello")
def hello_world():
return "hello, world!"
@app.route("/echo")
def echo_data(data):
return data
You can also specify methods
directly as a dict()
during Murloc initialization:
# main.py
from murloc import Murloc
def hello_world():
return "hello, world!"
def echo_data(data):
return data
app = Murloc(methods={"/hello": hello_world, "/echo": echo_data})
Run the murloc server with uvicorn like so:
$ uvicorn main:app
Or, with gunicorn (must support ASGI) like so:
$ gunicorn main:app --worker-class uvicorn.workers.UvicornWorker
Note: These examples assume main.py and the Murloc variable
app
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
murloc-0.1.0.tar.gz
(3.1 kB
view hashes)
Built Distribution
murloc-0.1.0-py3-none-any.whl
(4.3 kB
view hashes)