api_server.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:arc 作者: lap00zza 项目源码 文件源码
def __init__(self):
        Flask.__init__(self, __name__)

        # Auth Initialization
        # NOTE: To invalidate all JWT's just change this secret.
        self.auth = Auth(os.environ.get("JWT_SECRET"), "HS256")

        # Database initialization
        self.db = DB()
        self.db.connect()

        # Register the routes
        # TODO: message rate limit 10 per 5 second
        self.route("/api", methods=["GET", "POST"])(self.index)
        self.route("/api/v1/myInfo", methods=["GET"])(self.my_info)
        self.route("/api/v1/channel/<channel_id>/messages", methods=["POST"])(self.messages)
        self.route("/api/v1/auth/login", methods=["POST"])(self.login)
        self.route("/api/v1/auth/register", methods=["POST"])(self.register)

        # start the ws client thread
        self.ws_client = WSClient()
        self.ws_client.start()

        # TODO: this is temporary redis replacement. Remove it later.
        self.mem_store = MemStore()

    # --- HELPER METHODS ---
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号