A simple web application built with Node.js, Express, and MongoDB for you to readily get a shortened URL to use
- User can input a set of URL aiming to be shortened
- User can get a warning message for invalid URL format input
- User can get a set of shortened URL from the original URL provided
- User can copy the shortened URL to clipboard by clicking the copy button
- User can reset the input columns for next URL generation
- User can be redirected to the original URL by visiting the shortened URL
- Admin can configure validation of URLS to restrict urls redirections. Eg:
export URL_SHORTENER_URL_REGEXP="^https?://[^/]*.mydomain.com(/.*|)$"
export URL_SHORTENER_URL_ERROR_MESSAGE="url must refer to mydomain.com"
export URL_SHORTENER_QR_IMAGE="https://url.to/image.png"
see file controllers/convert.js
for more configuration settings.
The following instructions will get you a copy of the project and all the setting needed to run it on your local machine.
Clone this repository to your local machine
$ git clone [email protected]:Unipisa/url-shortener.git
** Install npm packages**
$ npm install
** Start a database server**
$ docker-compose up -d
** Activate the web server**
$ npm run dev
** Wait the message for successful activation**
> mongodb connected!
> App is running: https://localhost:3000
Now you may visit the application on browser at URL: http://localhost:3000
For production you can use the docker image https://hub.docker.com/r/paolini/url-shortener
- Can I try this app online?
- Yes, kindly visit [https://go.dm.unipi.it/]
- or the original (forked from) version https://ancient-cove-62781.herokuapp.com/
- original code: Mike Huang
- adapted by: Emanuele Paolini