Skip to content

URL Expander and Shortener is a Flask-based web application that allows users to shorten long URLs and expand shortened URLs back to their original form. This project provides an API for URL shortening and expansion, with functionality tested using `curl` and Postman. It includes a simple in-memory URL mapping for demonstration purposes.

Notifications You must be signed in to change notification settings

CodewithDili/URL-Expander-and-Shortener-API-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Expander and Shortener API

This is a simple Flask application that provides an API for URL expansion and shortening. The application uses two functions from the utils module: shorten_url and expand_url.

Getting Started

  1. Clone the repository or download the code.
  2. Install the required dependencies by running pip install -r requirements.txt.
  3. Run the application by executing python app.py.

API Endpoints

The application provides the following API endpoints:

  • GET /: Returns a welcome message.
  • POST /shorten: Accepts a JSON object with a url field containing the long URL to be shortened. The application will return a JSON object containing the shortened URL.
  • GET /expand/<short_url>: Accepts a short_url parameter. The application will return a JSON object containing the long URL if it exists, or an error message if the URL is not found.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

About

URL Expander and Shortener is a Flask-based web application that allows users to shorten long URLs and expand shortened URLs back to their original form. This project provides an API for URL shortening and expansion, with functionality tested using `curl` and Postman. It includes a simple in-memory URL mapping for demonstration purposes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages