Skip to content

dukeofharen/urlshortener.js

Repository files navigation

Node.js + Express.js URL shortener

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/.

Installation

  1. Download the files to the location you would like application to be.
  2. Go to the folder with the command line and execute npm install, so all dependencies will be installed.
  3. In your MySQL database, create a new table and execute urlshortener.sql
  4. In constants.js, fill in the correct MySQL settings and fill in your root URL (e.g. http://d.co/ or http://localhost:3500/)
  5. 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).

Note

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.

About

A simple URL shortener created with Node.js + Express.js + MySQL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published