Give the blueprint a better name: apiService

SPM2023S-QianJunQi
Lan Hui 2024-08-31 07:38:30 +08:00
parent ceb5f14ee9
commit 621ac24991
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ from Article import load_freq_history
path_prefix = '/var/www/wordfreq/wordfreq/'
path_prefix = './' # comment this line in deployment
show_bp = Blueprint('site',__name__)
apiService = Blueprint('site',__name__)
auth = HTTPTokenAuth(scheme='Bearer')
@ -21,7 +21,7 @@ def verify_token(token):
return tokens[token]
@show_bp.route('/api/mywords') # HTTPie usage: http -A bearer -a secret-token http://127.0.0.1:5000/api/mywords
@apiService.route('/api/mywords') # HTTPie usage: http -A bearer -a secret-token http://127.0.0.1:5000/api/mywords
@auth.login_required
def show():
username = auth.current_user()

View File

@ -10,7 +10,7 @@ import Yaml
from user_service import userService
from account_service import accountService
from admin_service import adminService, ADMIN_NAME
from api_service import show_bp
from api_service import apiService
import os
from translate import *
@ -22,7 +22,7 @@ app.secret_key = os.urandom(32)
app.register_blueprint(userService)
app.register_blueprint(accountService)
app.register_blueprint(adminService)
app.register_blueprint(show_bp)
app.register_blueprint(apiService)
path_prefix = '/var/www/wordfreq/wordfreq/'
path_prefix = './' # comment this line in deployment