Skip to main content

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


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)

Uploaded Source

Built Distribution

murloc-0.1.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page