def loadWebUI(app, devel=False, coffee=False):
    ''' Load endpoints for bottle app'''

    #catch all for page refreshes of any app url
    @app.route('/app/<path:path>') # /app/<path>
    @app.route('/app/') # /app/
    @app.route('/app') # /app
    @app.route('/') # /
    def appGet(path=''):
        if devel:
            return(  createStaticMain(    kind='bottle',
                                            base=args.base,
                                            coffee=args.coffee,
                                            devel=args.devel,
                                            save=False,))
        return bottle.static_file('main.html', root=STATIC_APP_PATH)

    @app.route('/static/lib/<filepath:re:.*\.(woff)>')
    def staticFontWoffGet(filepath):
        return bottle.static_file(filepath, root=STATIC_LIB_PATH, mimetype='application/font-woff')

    @app.route('/static/app/<filepath:path>')
    def staticAppGet(filepath):
        return bottle.static_file(filepath, root=STATIC_APP_PATH)

    @app.route('/static/lib/<filepath:path>')
    def staticLibGet(filepath):
        return bottle.static_file(filepath, root=STATIC_LIB_PATH)

    @app.get('/test')
    def testGet():
        '''
        Test endpoint for bottle application
        Shows location of this file
        Shows all routes in current bottle app
        '''
        bottle.response.set_header('content-type', 'text/plain')
        content =  "Web app file is located at %s" % os.path.dirname(os.path.abspath(__file__))
        siteMap = ""

        currentApp = bottle.app()

        for route in currentApp.routes:
            siteMap = "%s%s%s %s" %  (siteMap, '\n' if siteMap else '', route.rule, route.method)
            target = route.config.get('mountpoint', {}).get('target')
            if target:
                for way in target.routes:
                    siteMap = "%s\n    %s %s" %  (siteMap, way.rule, way.method)

        content = "%s\n%s" %  (content, siteMap)
        return content


    @app.get('/echo')
    @app.get('/echo/<action>')
    def echoGet(action=None):
        '''
        Ajax test endpoint for web application service
        Echos back query args and content
        '''
        #convert to json serializible dict
        query = dict(bottle.request.query.items())

        data = dict(verb='GET',
                    url=bottle.request.url,
                    action=action,
                    query=query,
                    content=bottle.request.json)

        return data

    @app.get('/ping')
    def pingGet():
        ''' Send salt ping'''
        import salt.client
        import salt.config
        __opts__ = salt.config.client_config(
                    os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master'))
        local = salt.client.LocalClient(__opts__['conf_file'])
        local.cmd('*', 'test.ping',  username="saltwui", password='dissolve', eauth='pam')

        return dict(result = "Sent Ping")

    @app.get('/stream')
    def streamGet():
        ''' Create server sent event stream with counter'''
        bottle.response.set_header('Content-Type',  'text/event-stream') #text
        bottle.response.set_header('Cache-Control',  'no-cache')
        # Set client-side auto-reconnect timeout, ms.
        yield 'retry: 1000\n\n'
        yield 'data: START\n\n'
        n = 1
        end = time.time() + 600 # Keep connection alive no more then... (s)
        while time.time() < end:
            yield 'data: %i\n\n' - n
            n += 1
            gevent.sleep(1.0) if gevented else time.sleep(1.0)

        yield "data: END\n\n"
dataset/ETHPy150Open saltstack/halite/halite/server_bottle.py/loadWebUI/operator `%` -> `-`