/shortly

A Simple URL shortener built with MERN.

Primary LanguageJavaScript

🔗 Shortly - A Simple URL Shortner

Heroku

Shortly Demo

> This is a URL Shortner built using MERN Stack.

Prerequisites

  • npm >=5.5.0

  • node >=9.3.0

🛠 Local Development

Install

Install both client and server dependencies

# Install dependencies for server
$ npm install

# Install dependencies for client
$ npm run client-install

Configuration

1. Create a nodemon.json file in project root dir

$ touch nodemon.json

2. Feed values to the file like this -

{
    "env": {

        "mongoURI": "",

        "baseUrl": "http://localhost:5000",

        "NODE_ENV": "development"
    }
}

ℹ️ To get the mongoURI, you can install MongoDB locally , use MongoDB Atlas or simply use MLab.

Usage

# Run the client & server with concurrently
$ npm run dev

# Run the Express server only
$ npm run server

# Run the React client only
$ npm run client

# Server runs on http://localhost:5000 and client on http://localhost:3000

🚀 Production Deployment

There is a Heroku post build script so that you don't have to compile your React frontend manually, it is done on the server. Simply push to Heroku and it will build and load the client index.html page