-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (24 loc) · 856 Bytes
/
main.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
from flask import Flask, request, jsonify
import requests
# create flask instance
app = Flask(__name__, static_folder='dist', static_url_path='')
@app.route('/')
def index():
return app.send_static_file('index.html')
@app.route('/bar-chart/')
def chart():
return app.send_static_file('bar-chart/index.html')
@app.route('/countdown-timer/')
def countdowntimer():
# app.logger.info('%s', app.root_path)
return app.send_static_file('countdown-timer/index.html')
@app.route('/url-shortening/')
def urlshorten():
# app.logger.info('%s', app.root_path)
return app.send_static_file('url-shortening/index.html')
@app.route('/api/shorten', methods=['POST'])
def shorten():
r = requests.post('https://cleanuri.com/api/v1/shorten', data=request.json)
response = r.json()
app.logger.info(response)
return jsonify(response)