Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master2 #54

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
22 changes: 18 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
from flask import Flask
from flask import Flask, jsonify,json


app = Flask(__name__)

@app.route('/')
def hello_world():
return 'Hello, World!'
# Ruta para devolver el JSON
@app.route('/get_json')
def get_json():
data = {
"key1": "value1",
"key2": "value2"
}
return jsonify(data)

@app.route('/', methods=['GET'])
def index():
with open('static/example2.json', 'r') as f:
data = json.load(f)
return jsonify(data)

125 changes: 125 additions & 0 deletions example2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"locales": [
{
"id": 1,
"nombre_local": "Local name",
"pantallas": [
{
"nombre_pantalla": "Screen 1",
"productos": [
{
"nombre_producto": "Producto 1",
"precio": "888888888888"
},
{
"nombre_producto": "Producto 2",
"precio": "888888888"
},
{
"nombre_producto": "Producto 3",
"precio": "8888888888"
}
]
},
{
"nombre_pantalla": "Screen 2",
"productos": [
{
"nombre_producto": "Producto 4",
"precio": "1"
},
{
"nombre_producto": "Producto 5",
"precio": "33"
},
{
"nombre_producto": "Producto 6",
"precio": "1111111111111111111111111111111111"
}
]
},
{
"nombre_pantalla": "Screen 3",
"productos": [
{
"nombre_producto": "Producto 7",
"precio": "56"
},
{
"nombre_producto": "Producto 8",
"precio": "50"
}
]
},
{
"nombre_pantalla": "Screen 4",
"productos": [
{
"nombre_producto": "Producto 9",
"precio": "60"
},
{
"nombre_producto": "Producto 10",
"precio": "35"
}
]
}
]
},
{
"id": 2,
"nombre_local": "Another local name",
"pantallas": [
{
"nombre_pantalla": "Screen A",
"productos": []
},
{
"nombre_pantalla": "Screen B",
"productos": []
},
{
"nombre_pantalla": "Screen C",
"productos": [
{
"nombre_producto": "Producto 11",
"precio": 49.99
},
{
"nombre_producto": "Producto 12",
"precio": 39.99
}
]
},
{
"nombre_pantalla": "Screen D",
"productos": [
{
"nombre_producto": "Producto 13",
"precio": 24.99
},
{
"nombre_producto": "Producto 14",
"precio": 14.99
}
]
}
]
},
{
"id": 3,
"nombre_local": "Caribbean",
"pantallas": []
},
{
"id": 4,
"nombre_local": "Caribbean",
"pantallas": []
},
{
"id": 5,
"nombre_local": "Caribbean 2",
"pantallas": []
}
]
}
Empty file added pip
Empty file.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Flask
flask
Gunicorn
125 changes: 125 additions & 0 deletions static/example2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"locales": [
{
"id": 1,
"nombre_local": "Local name",
"pantallas": [
{
"nombre_pantalla": "Screen 1",
"productos": [
{
"nombre_producto": "Producto 1",
"precio": "888888888888"
},
{
"nombre_producto": "Producto 2",
"precio": "888888888"
},
{
"nombre_producto": "Producto 3",
"precio": "8888888888"
}
]
},
{
"nombre_pantalla": "Screen 2",
"productos": [
{
"nombre_producto": "Producto 4",
"precio": "1"
},
{
"nombre_producto": "Producto 5",
"precio": "33"
},
{
"nombre_producto": "Producto 6",
"precio": "1111111111111111111111111111111111"
}
]
},
{
"nombre_pantalla": "Screen 3",
"productos": [
{
"nombre_producto": "Producto 7",
"precio": "56"
},
{
"nombre_producto": "Producto 8",
"precio": "50"
}
]
},
{
"nombre_pantalla": "Screen 4",
"productos": [
{
"nombre_producto": "Producto 9",
"precio": "60"
},
{
"nombre_producto": "Producto 10",
"precio": "35"
}
]
}
]
},
{
"id": 2,
"nombre_local": "Another local name",
"pantallas": [
{
"nombre_pantalla": "Screen A",
"productos": []
},
{
"nombre_pantalla": "Screen B",
"productos": []
},
{
"nombre_pantalla": "Screen C",
"productos": [
{
"nombre_producto": "Producto 11",
"precio": 49.99
},
{
"nombre_producto": "Producto 12",
"precio": 39.99
}
]
},
{
"nombre_pantalla": "Screen D",
"productos": [
{
"nombre_producto": "Producto 13",
"precio": 24.99
},
{
"nombre_producto": "Producto 14",
"precio": 14.99
}
]
}
]
},
{
"id": 3,
"nombre_local": "Caribbean",
"pantallas": []
},
{
"id": 4,
"nombre_local": "Caribbean",
"pantallas": []
},
{
"id": 5,
"nombre_local": "Caribbean 2",
"pantallas": []
}
]
}
1 change: 1 addition & 0 deletions static/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello