Пример #1
0
def login():


routes = [
    Route('/', 'GET', welcome),
    Include('/docs', docs_urls),
    Include('/static', static_urls)
]

app = App(routes=routes)


if __name__ == '__main__':
    app.main()
Пример #2
0
from api import routes


def welcome(name=None):
    if name is None:
        return {'message': 'Welcome to db Star!'}
    return {'message': 'Welcome to db Star, %s!' % name}


routes = routes + \
         [
             Include('/docs', docs_urls),
             Include('/static', static_urls)
         ]

# Configure database settings
settings = {
    "DATABASE": {
        "URL": "sqlite:///Test.db",
        "METADATA": Base.metadata
    }
}

app = App(routes=routes,
          settings=settings,
          commands=sqlalchemy_backend.commands,
          components=sqlalchemy_backend.components)

if __name__ == '__main__':
    app.main()
Пример #3
0
from apistar import Route, Include
from apistar.frameworks.wsgi import WSGIApp as App
from apistar.handlers import docs_urls

from view.user import user_auth, user_join


def ping():
    '''
    :return: dict
    '''
    return {"status": "ok"}


routes = [
    Route('/ping', 'GET', ping),

    # 認証
    Route('/user/auth', "GET", user_auth),
    Route('/user/join', "POST", user_join),
    Include('/docs', docs_urls),
]

app = App(routes=routes)  # Install custom components.)

if __name__ == "__main__":
    app.main(["run"])