A simple URL shortener application that allows users to shorten long URLs, manage their shortened URLs, and redirect shortened URLs to the original links.
- Shorten long URLs into a concise, shareable link
- Redirect shortened URLs to the original URLs
- Backend: Node.js, Express
- Frontend: HTML, CSS, JavaScript
- Other Dependencies:
Follow these instructions to get a copy of the project up and running on your local machine.
- Node.js installed on your machine
-
Clone the repository:
git clone https://github.com/Taran1508/UrlShortener.git cd urlshortener
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your configurations:PORT=3000 BASE_URL=http://localhost:3000
-
Start the application:
npm start
-
Open your browser and visit
http://localhost:3000
.
- Enter a long URL in the input field and click on the "Shorten" button.
- You will receive a shortened URL that you can copy and share.
- Access the shortened URL to be redirected to the original URL.
Method | Endpoint | Description |
---|---|---|
POST | /shorten |
Shorten a long URL |
GET | /:id |
Redirect to the original URL |
urlshortener/
│
├── .env # Environment variables
├── package.json # NPM dependencies
├── public/ # Static files (HTML, CSS, JS)
├── src # Source file
├── controllers/ # Controller functions for handling requests
├── routes/ # API routes
└── app.js # Main server file
├── views/ # View templates (if using templating engine)
├── LICENSE
└── Readme.md # Readme File
Feel free to open issues or submit pull requests for improvements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.