-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (25 loc) · 922 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/signup', methods=['POST'])
def signup():
data = request.json
username = data['username']
mail = data['mail']
password = data['password']
# Perform additional validation if needed
# Save user details to a database (example with SQLite)
import sqlite3
conn = sqlite3.connect('users.db')
cursor = conn.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS users
(username TEXT, mail TEXT, password TEXT)''')
cursor.execute('INSERT INTO users (username, mail, password) VALUES (?, ?, ?)',
(username, mail, password))
conn.commit()
conn.close()
return jsonify({'message': 'Sign up successful!'})
if __name__ == '__main__':
app.run(debug=True)