Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.09 KB

File metadata and controls

37 lines (27 loc) · 1.09 KB

servc-python

Serv-C implmentation for Python. Documentation can be found here

PyPI version Serv-C Serv-C Compliancy PyPI - Downloads Docker Pulls

Example

Here is the most simple example of use, starting a server to handle requests at the route my-route;

from typing import Any

from servc.server import start_server
from servc.svc.com.worker.types import RESOLVER_CONTEXT, RESOLVER_RETURN_TYPE

def inputProcessor(
  messageId: str,
  payload: Any,
  context: RESOLVER_CONTEXT,
) -> RESOLVER_RETURN_TYPE:
  return True

# the method 'methodA' will be resolved by inputProcessor
start_server(
  resolver={
    "methodA": inputProcessor
  }
)