forked from NeelayK/VGnetLabWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
61 lines (48 loc) · 2.05 KB
/
app.py
File metadata and controls
61 lines (48 loc) · 2.05 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from flask import Flask, jsonify
from flask_cors import CORS
from supabase import create_client
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
SUPABASE_URL = "https://prfkhjuujnheztwhwmcd.supabase.co"
SUPABASE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InByZmtoanV1am5oZXp0d2h3bWNkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDE4MDk2NjIsImV4cCI6MjA1NzM4NTY2Mn0.j92nEtB5mUORV5VlCpLsTbJNinSykjnpaX0R1cnZQXc"
supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
@app.route('/publications', methods=['GET'])
def get_publications():
try:
response = supabase.table('publications').select('*').order('id', desc=False).limit(10).execute()
return jsonify(response.data)
except Exception as e:
print(f"Error fetching data: {e}")
return jsonify({"error": "Internal Server Error"}), 500
@app.route('/projects', methods=['GET'])
def get_projects():
try:
response = supabase.table('projects').select('*').execute()
return jsonify(response.data)
except Exception as e:
print(f"Error fetching data: {e}")
return jsonify({"error": "Internal Server Error"}), 500
@app.route('/collabs', methods=['GET'])
def get_collabs():
try:
response = supabase.table('collabs').select('*').execute()
return jsonify(response.data)
except Exception as e:
print(f"Error fetching data: {e}")
return jsonify({"error": "Internal Server Error"}), 500
@app.route('/team', methods=['GET'])
def get_team():
try:
response = supabase.table('team').select('*').execute()
return jsonify(response.data)
except Exception as e:
print(f"Error fetching data: {e}")
return jsonify({"error": "Internal Server Error"}), 500
@app.route('/gallery', methods=['GET'])
def get_gallery():
try:
response = supabase.table('gallery').select('*').execute()
return jsonify(response.data)
except Exception as e:
print(f"Error fetching data: {e}")
return jsonify({"error": "Internal Server Error"}), 500