Example #1
0
    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("/users/list", user_resources.ResourceGetUsers())

application.add_route("/trivial/question/list", trivial_events.ResourceGetQuestions())
application.add_route("/trivial/question", trivial_events.ResourceGetRandomQuestion())
application.add_route("/trivial/question/validate", trivial_events.ResourceValidateQuestion())
application.add_route("/trivial/question/add", trivial_events.ResourceAddQuestion())


application.add_sink(handle_404, "")
Example #2
0
])
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("/users/list", user_resources.ResourceGetUsers())

application.add_route("/trivial/question/list",
                      trivial_events.ResourceGetQuestions())
application.add_route("/trivial/question",
                      trivial_events.ResourceGetRandomQuestion())
application.add_route("/trivial/question/add",
                      trivial_events.ResourceAddQuestion())
application.add_route("/trivial/question_no_answer",
                      trivial_events.ResourceGetRandomQuestionNoAnswer())

application.add_route("/trivial/check_question/{id_pregunta}/{id_respuesta}",
                      trivial_events.ResourceCheckQuestion())

application.add_sink(handle_404, "")