mirror of
https://github.com/kevin-DL/ShortMe-URL-Shortener.git
synced 2026-01-20 14:45:09 +00:00
Initial commit
This commit is contained in:
19
app/server/routes/your_short_url.py
Normal file
19
app/server/routes/your_short_url.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# ------- 3rd party imports -------
|
||||
import flask
|
||||
from flask import Blueprint, render_template, request
|
||||
|
||||
your_short_url_blueprint = Blueprint('your_short_url_blueprint', __name__, template_folder='templates')
|
||||
|
||||
|
||||
@your_short_url_blueprint.route('/your_short_url')
|
||||
def your_short_url():
|
||||
original_url = request.args['original_url']
|
||||
short_url = request.args['short_url']
|
||||
base_url = flask.url_for("index_blueprint.index", _external=True)
|
||||
full_short_url = f'{base_url}{short_url}'
|
||||
full_short_url = full_short_url.replace('http://www.', '')
|
||||
|
||||
return render_template('your_short_url.html',
|
||||
original_url=original_url,
|
||||
short_url=short_url,
|
||||
full_short_url=full_short_url)
|
||||
Reference in New Issue
Block a user