Live Link:URL Shortener
This is a URL shortener service that allows you to shorten long URLs and customize the shortened URLs with an alias. The shortened URLs have an expiration feature that automatically expires them if there are no requests for them within a 24-hour period.
- Shorten Long URLs: Convert long URLs into shorter, more manageable URLs.
- Customize Alias: Assign a custom alias to the shortened URL for easy identification and sharing.
- Expiration: Automatically expire shortened URLs if there are no requests for them within a 24-hour period.
- Analytics: Track and analyze the usage of shortened URLs, including the number of clicks and the referring websites.
- Clone the repository:
git clone https://github.com/your/repository.git
- Install the required dependencies:
npm install
- Set up the database: Create a database and configure the connection settings in
config/database.js
. - Start the server:
node server.js
- Access the URL shortener service through the web interface or API endpoint.
- To shorten a long URL, provide the URL in the appropriate field and submit it.
- If you want to customize the shortened URL, specify an alias during the shortening process.
- The service will generate a shortened URL based on the provided alias or generate a random one if no alias is specified.
- Share the shortened URL with others.
- The shortened URL will expire if there are no requests for it within a 24-hour period.
- Track and analyze the usage of shortened URLs through the provided analytics feature.
- Endpoint:
/shorten
- Method: POST
- Request Body:
url
(required): The long URL to be shortened.alias
(optional): The desired alias for the shortened URL.
- Response:
shortUrl
: The generated shortened URL.
- Endpoint:
/:alias
- Method: GET
- Response:
- Redirects to the original long URL associated with the provided alias.
- The expiration time for shortened URLs can be adjusted in
server.js
. - Database connection settings can be configured in
server.js
. - Additional customization options can be found in the respective configuration files.
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make the necessary changes and commit your code.
- Submit a pull request describing your changes.