This guide will help you get started with Netcore quickly.
Here’s a minimal example that demonstrates the core functionality:
from netcore import Endpoint, Pipe
# Define custom transport functions
def recv_func(size):
return your_device.read(size)
def send_func(data):
your_device.write(data)
# Create communication pipe
pipe = Pipe(recv_func, send_func)
# Create endpoint
endpoint = Endpoint(pipe)
# Register route handler
@endpoint.route("echo")
def handle_echo():
return Response("echo", request.data)
# Start service
endpoint.start()