Beispiel #1
0
# DEFAULT 404
# noinspection PyUnusedLocal
def handle_404(req, resp):
    resp.media = messages.resource_not_found
    resp.status = falcon.HTTP_404


# FALCON
app = application = falcon.API(
    middleware=[
        middlewares.DBSessionManager(),
        middlewares.Falconi18n(),
        MultipartMiddleware()
    ]
)
application.add_route("/", common_resources.ResourceHome())

application.add_route("/account/profile", account_resources.ResourceAccountUserProfile())
application.add_route("/account/profile/update_profile_image", account_resources.ResourceAccountUpdateProfileImage())
application.add_route("/account/create_token", account_resources.ResourceCreateUserToken())
application.add_route("/account/delete_token", account_resources.ResourceDeleteUserToken())

application.add_route("/users/register", user_resources.ResourceRegisterUser())
application.add_route("/users/show/{username}", user_resources.ResourceGetUserProfile())

application.add_route("/events", event_resources.ResourceGetEvents())
application.add_route("/events/show/{id:int}", event_resources.ResourceGetEvent())
application.add_route("/events/mostra/{name}", event_resources.ResourceGetName())

application.add_sink(handle_404, "")
Beispiel #2
0
# DEFAULT 404
# noinspection PyUnusedLocal
def handle_404(req, resp):
    resp.media = messages.resource_not_found
    resp.status = falcon.HTTP_404


# FALCON
app = application = falcon.API(
    middleware=[middlewares.DBSessionManager(),
                middlewares.Falconi18n()])
application.add_route("/", common_resources.ResourceHome())

application.add_route("/account/profile",
                      account_resources.ResourceAccountUserProfile())
application.add_route("/account/create_token",
                      account_resources.ResourceCreateUserToken())
application.add_route("/account/delete_token",
                      account_resources.ResourceDeleteUserToken())

application.add_route("/anuncis/create",
                      anunci_resources.ResourceCreateAnunci())
application.add_route("/anuncis/list", anunci_resources.ResourceGetAnuncis())
application.add_route("/anuncis/show/{id}",
                      anunci_resources.ResourceGetAnunci())

application.add_route("/users/register", user_resources.ResourceRegisterUser())
application.add_route("/users/show/{username}",
                      user_resources.ResourceGetUserProfile())
application.add_sink(handle_404, "")
Beispiel #3
0
def handle_404(req, resp):
    resp.media = messages.resource_not_found
    resp.status = falcon.HTTP_404


# FALCON
app = application = falcon.API(
    middleware=[
        middlewares.DBSessionManager(),
        middlewares.Falconi18n()
    ]
)
application.add_route("/", common_resources.ResourceHome())

application.add_route("/account/profile", account_resources.ResourceAccountUserProfile())
application.add_route("/account/anotherprofile", user_resources.ResourceGetUserProfile())
application.add_route("/account/logout", user_resources.ResourceLogOut())


application.add_route("/account/create_token", account_resources.ResourceCreateUserToken())
application.add_route("/account/delete_token", account_resources.ResourceDeleteUserToken())

application.add_route("/users/register", user_resources.ResourceRegisterUser())
application.add_route("/users/show/{username}", user_resources.ResourceGetUserProfile())

application.add_route("/favours", event_resources.ResourceGetEvents())
application.add_route("/favours/update/{id}", event_resources.UpdateFavour())
application.add_route("/favours/delete/{id}", event_resources.DeleteFavour())
application.add_route("/favours/add", event_resources.ResourcePostFavour())
application.add_route("/account/update_profile", user_resources.UpdateUser())