Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion api-service/api.py → api-service/index.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from flask import Flask
from flask import Flask, jsonify, make_response
import argparse
from widgets.handler import widget_bp

app = Flask(__name__)

app.register_blueprint(widget_bp, url_prefix='/widget')

@app.route('/')
def base_page():
msg= jsonify({"success" : 'yayyyyy'})
res= make_response(msg,200)
res.headers['Content-Type'] = 'application/json'
return res



if __name__ == '__main__':

# Get the arguments of the given command
Expand Down
15 changes: 15 additions & 0 deletions api-service/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": 2,
"builds": [
{
"src": "./index.py",
"use": "@vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/"
}
]
}
3 changes: 1 addition & 2 deletions api-service/widgets/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
class WeatherAPI(MethodView):

def get(self) -> Response:

args = request.args
latitude: float = args.get('latitude')
longitude: float = args.get('longitude')
Expand Down Expand Up @@ -46,5 +45,5 @@ def post(self) -> Response:
'/weather', view_func=WeatherAPI.as_view('weather'), methods=['GET'])

widget_bp.add_url_rule(
'/news', view_func=NewsAPI.as_view('news'), methods=[])
'/news', view_func=NewsAPI.as_view('news'), methods=['GET'])