forked from mrlan/EnglishPal
				
			Give the blueprint a better name: apiService
							parent
							
								
									ceb5f14ee9
								
							
						
					
					
						commit
						621ac24991
					
				|  | @ -5,7 +5,7 @@ from Article import load_freq_history | ||||||
| path_prefix = '/var/www/wordfreq/wordfreq/' | path_prefix = '/var/www/wordfreq/wordfreq/' | ||||||
| path_prefix = './'  # comment this line in deployment | path_prefix = './'  # comment this line in deployment | ||||||
| 
 | 
 | ||||||
| show_bp = Blueprint('site',__name__) | apiService = Blueprint('site',__name__) | ||||||
| 
 | 
 | ||||||
| auth = HTTPTokenAuth(scheme='Bearer') | auth = HTTPTokenAuth(scheme='Bearer') | ||||||
| 
 | 
 | ||||||
|  | @ -21,7 +21,7 @@ def verify_token(token): | ||||||
|         return tokens[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 | @auth.login_required | ||||||
| def show(): | def show(): | ||||||
|     username = auth.current_user() |     username = auth.current_user() | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ import Yaml | ||||||
| from user_service import userService | from user_service import userService | ||||||
| from account_service import accountService | from account_service import accountService | ||||||
| from admin_service import adminService, ADMIN_NAME | from admin_service import adminService, ADMIN_NAME | ||||||
| from api_service import show_bp | from api_service import apiService | ||||||
| import os | import os | ||||||
| from translate import * | from translate import * | ||||||
| 
 | 
 | ||||||
|  | @ -22,7 +22,7 @@ app.secret_key = os.urandom(32) | ||||||
| app.register_blueprint(userService) | app.register_blueprint(userService) | ||||||
| app.register_blueprint(accountService) | app.register_blueprint(accountService) | ||||||
| app.register_blueprint(adminService) | app.register_blueprint(adminService) | ||||||
| app.register_blueprint(show_bp) | app.register_blueprint(apiService) | ||||||
| 
 | 
 | ||||||
| path_prefix = '/var/www/wordfreq/wordfreq/' | path_prefix = '/var/www/wordfreq/wordfreq/' | ||||||
| path_prefix = './'  # comment this line in deployment | path_prefix = './'  # comment this line in deployment | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue