A simple URL Shortener web application built using Node.js, Express, MongoDB, and EJS.
- Shorten long URLs into short, shareable links.
- Redirect shortened URLs to their original destination.
- Simple and user-friendly UI.
- Frontend: EJS, CSS
- Backend: Node.js, Express.js
- Database: MongoDB
-
Clone the repository:
git clone https://github.com/your-username/url-shortener.git cd url-shortener -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile and add:MONGODB_URI=your_mongodb_connection_string BASE_URL=http://localhost:3000
-
Start the server:
npm start
The app will run on
http://localhost:3000.
| Method | Endpoint | Description |
|---|---|---|
| POST | /shorten |
Shorten a long URL |
| GET | /:shortCode |
Redirect to original URL |
Feel free to submit issues or pull requests!