A simple URL shortener created with Node.js + Express.js + MySQL. This project is part of a tutorial: https://ducode.org/posts/url-shortener-in-node-js-express-js-mysql-tutorial-learning-by-doing/.
- Download the files to the location you would like application to be.
- Go to the folder with the command line and execute
npm install
, so all dependencies will be installed. - In your MySQL database, create a new table and execute
urlshortener.sql
- In
constants.js
, fill in the correct MySQL settings and fill in your root URL (e.g. http://d.co/ or http://localhost:3500/) - If you install this script on your server and you have a custom short domain, make sure you create a reverse proxy in your Apache or Nginx (or any other server), so your domain (e.g. d.co) points to
http://localhost:3500/
(or any other port number you've configured).
This script is meant to be used as a public URL shortener. If you want to use this script for personal use, you have to include some sort of authentication.