This is a URL-shortener service written on Python with Flask framework
- Clone the repository
git clone git@github.com:Evgeniy-Golodnykh/urlcut.git
- Creates a virtual environment
python3 -m venv venv
- Activates the virtual environment
source venv/bin/activate
- Upgrade PIP and installs the requirements package into the virtual environment
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- Configure the .env file like this
FLASK_APP=urlcut
DATABASE_URI=sqlite:///urlcut_db.sqlite3
SECRET_KEY=YOUR_SECRET_KEY
- To run the application use command
flask run
# Endpoint to retrieve the original URL
Method: GET
Endpoint: "{your_local_host}:5000/api/id/{custom_id}/"
# Endpoint to create a short link
Method: POST
Endpoint: "{your_local_host}:5000/api/id/"
Request: {
"url": "string", # required
"custom_id": "string" # not required
}