# cPy - simple WebApp showing "Hello World"
# provided by Anthony Vogelaar, Perth Scotland
# rev 0.10  2025-02-27  initial release

from    microdot    import  Microdot
import  webbrowser

# =========================== local ================================

def openBrowser(port=5000):
    webbrowser.open('localhost:5000', new=1)             # open een new browser window

# ========================== webserver =============================

def webServer(port=5000):
    app = Microdot()

    @app.route('/')
    async def index(request):
        return 'Hello, world!'

    app.run(port=port)

# ============================ main ================================

def main():
    openBrowser()
    webServer()


main()

# ============================= end =================================
