servir a index.html a rotas
This commit is contained in:
		
							
								
								
									
										34
									
								
								app/app.py
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								app/app.py
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
from flask import Flask, request, jsonify
 | 
					from flask import Flask, request, jsonify, send_file
 | 
				
			||||||
from flask_cors import CORS
 | 
					from flask_cors import CORS
 | 
				
			||||||
from pymongo import MongoClient
 | 
					from pymongo import MongoClient
 | 
				
			||||||
from datetime import datetime, timedelta
 | 
					from datetime import datetime, timedelta
 | 
				
			||||||
@@ -76,10 +76,40 @@ def init_default_categories(user_id):
 | 
				
			|||||||
        })
 | 
					        })
 | 
				
			||||||
    if categories:
 | 
					    if categories:
 | 
				
			||||||
        categories_collection.insert_many(categories)
 | 
					        categories_collection.insert_many(categories)
 | 
				
			||||||
 | 
					@app.route('/')
 | 
				
			||||||
 | 
					def serve_html_home():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/dashboard')
 | 
				
			||||||
 | 
					def serve_html_dashboard():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/login')
 | 
				
			||||||
 | 
					def serve_html_login():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/cadastro')
 | 
				
			||||||
 | 
					def serve_html_cadastro():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/transacoes')
 | 
				
			||||||
 | 
					def serve_html_transacoes():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/configuracoes')
 | 
				
			||||||
 | 
					def serve_html_configuracoes():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route('/about')
 | 
				
			||||||
 | 
					def serve_html_about():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					@app.route('/help')
 | 
				
			||||||
 | 
					def serve_html_help():
 | 
				
			||||||
 | 
					    return send_file('../web/assets/index.html')
 | 
				
			||||||
# ROTAS DE AUTENTICAÇÃO
 | 
					# ROTAS DE AUTENTICAÇÃO
 | 
				
			||||||
@app.route('/api/auth/register', methods=['POST'])
 | 
					@app.route('/api/auth/register', methods=['POST'])
 | 
				
			||||||
def register():
 | 
					def register(): 
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        data = request.get_json()
 | 
					        data = request.get_json()
 | 
				
			||||||
        email = data.get('email', '').strip().lower()
 | 
					        email = data.get('email', '').strip().lower()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user