44 lines
1.3 KiB
Markdown
44 lines
1.3 KiB
Markdown
|
# eaapi.server
|
||
|
|
||
|
## Quickstart
|
||
|
|
||
|
```py
|
||
|
server = EAMServer("http://127.0.0.1:5000")
|
||
|
|
||
|
@server.handler("message", "get")
|
||
|
def message(ctx):
|
||
|
ctx.resp.append("message", expire="300", status="0")
|
||
|
|
||
|
server.run("0.0.0.0", 5000)
|
||
|
```
|
||
|
|
||
|
```py
|
||
|
EAMServer(
|
||
|
# The URL this server can be access at. Used for services
|
||
|
public_url,
|
||
|
# Add `/<service>/` as a prefix when generating service urls (useful when debugging games)
|
||
|
prefix_services: bool = False,
|
||
|
# If both the URL and the query params match, which one gets the final say?
|
||
|
prioritise_params: bool = False,
|
||
|
# Include e-Amusement specific details of why requests failed in the responses
|
||
|
verbose_errors: bool = False,
|
||
|
# The operation mode in services.get's response
|
||
|
services_mode: eaapi.const.ServicesMode = eaapi.const.ServicesMode.Operation,
|
||
|
# The NTP server to use in services.get
|
||
|
ntp_server: str = "ntp://pool.ntp.org/",
|
||
|
# Keepalive server to use in serices.get. We'll use our own if one is not specified
|
||
|
keepalive_server: str = None
|
||
|
)
|
||
|
|
||
|
@handler(
|
||
|
# Module name to handle. Will curry if method is not provided
|
||
|
module,
|
||
|
# Method name to handle
|
||
|
method=None,
|
||
|
# The datecode prefix to match during routing
|
||
|
dc_prefix=None,
|
||
|
# The service to use. Likely `local` or `local2` when handling game functions
|
||
|
service=None
|
||
|
)
|
||
|
```
|