1
This commit is contained in:
37
backend/app/__init__.py
Normal file
37
backend/app/__init__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from flask import Flask
|
||||
|
||||
from app.config import Config
|
||||
from app.extensions import cors, db, jwt
|
||||
from app.routes.admin_routes import admin_bp
|
||||
from app.routes.auth_routes import auth_bp
|
||||
from app.routes.content_routes import content_bp
|
||||
from app.routes.spam_routes import spam_bp
|
||||
from app.routes.user_routes import user_bp
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
|
||||
db.init_app(app)
|
||||
jwt.init_app(app)
|
||||
cors.init_app(app, supports_credentials=True)
|
||||
|
||||
app.register_blueprint(auth_bp, url_prefix="/api/auth")
|
||||
app.register_blueprint(user_bp, url_prefix="/api/user")
|
||||
app.register_blueprint(spam_bp, url_prefix="/api/spam")
|
||||
app.register_blueprint(content_bp, url_prefix="/api/content")
|
||||
app.register_blueprint(admin_bp, url_prefix="/api/admin")
|
||||
|
||||
@app.get("/api/health")
|
||||
def health_check():
|
||||
return {
|
||||
"code": 0,
|
||||
"message": "ok",
|
||||
"data": {
|
||||
"service": "spam-detect-backend",
|
||||
"version": "2.1.0",
|
||||
},
|
||||
}
|
||||
|
||||
return app
|
||||
Reference in New Issue
Block a user