Skip to content

URL shortening service, which provides short aliases for redirection of long URLs. Project is live now. You can check the link.

Notifications You must be signed in to change notification settings

Badhansen/url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener

Overview

There are two seperate applications. The Client which serves as Frontend(using React) and the API(using Node and Express).

Environment Variables

To run this project, you will need to add the following environment variables to your .env file. I have provided an example file .env.example please update it to your own in .env file without .example.

Variable Description
MONGODB_URI MongoDB URI
BASE Base URL for Shortening
DOMAIN http://localhost:3333 Or Base URL for React App
REACT_APP_SHORT $DOMAIN/api/short
REACT_APP_ALL $DOMAIN/api/all

References

How to run the API Locally

Clone the project

git clone https://github.com/Badhansen/url-shortener.git

Go to project directory and navigate to the api directory.

cd url-shortener/api

Install all the dependencies

npm install

Now start the server

npm start

API Reference

  POST /api/short
Field Type Description
Body json Original Url

Example:

POST http://localhost:3333/api/short
Content-Type: application/json

{
    "origUrl": "https://leetcode.com/problems/single-threaded-cpu/"
}

Get item

  GET /:urlid
Parameter Type Description
urlid string Unique URL Code

Example:

GET http://localhost:3333/SvPAyo

Test and Run the Backend

How to run the Client

  1. In another terminal, navigate to the client directory.
  2. Run npm install to install all dependencies.
  3. Run npm start to start the app

Resources and documentation I followed

About

URL shortening service, which provides short aliases for redirection of long URLs. Project is live now. You can check the link.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published