Giter Site home page Giter Site logo

maribelduran / url-shortener-microservice Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 21 KB

A Fullstack JavaScript application that creates shortened URLs :blue_heart:

Home Page: https://url-shortener-microsrvc.herokuapp.com/

JavaScript 56.51% CSS 11.49% HTML 32.00%
nodejs express mongodb microservices freecodecamp-backend javascript

url-shortener-microservice's Introduction

URL Shortener Microservice ๐Ÿ’™

This service accepts a URL as a parameter and will check whether it follows the valid https://www.google.com format. If the URL is valid, it will return both the original URL and shortened URL in the JSON response. If it is not valid, the JSON response will contain an error instead. When you visit that shortened URL, it will redirect you to the original link.

You can test it at https://url-shortener-microsrvc.herokuapp.com

A Full Stack Javascript application built using MongoDB, Node.js and Express. An API Project for FreeCodeCamp.

Example Creation Usage

Pass the URL to path https://url-shortener-microsrvc.herokuapp.com/new/[URL] as below:

Valid URL example

https://url-shortener-microsrvc.herokuapp.com/new/https://www.github.com

Invalid URL example (missing protocol)

https://url-shortener-microsrvc.herokuapp.com/new/www.github.com

Example Creation Output

Valid URL example JSON response output

{
  original_url: "https://www.github.com",
  shortened_url: "https://url-shortener-microsrvc.herokuapp.com/29183"
}

Usage:

Visiting the shortened URL: https://url-shortener-microsrvc.herokuapp.com/29183 will redirect to: https://www.github.com

To Run Project Locally

Prerequisites

In order to run this project locally, you should have the following installed:

Installation & Startup

  1. Fork this repo

  2. Clone the fork

  3. Install Dependencies: $ npm install

  4. Run your MongoDB server: $ mongod --port 27017 --dbpath=./data

    Note: Your mongoDB is now running at: mongodb://localhost:27017/<your_database_name>

  5. Add a .env file to your project's root directory and set MONGO_CONNECTION_STRING to mongodb://localhost:27017/<your_database_name>

    MONGO_CONNECTION_STRING=mongodb://localhost:27017/<your_database_name>
  6. Start the Server: $ node app.js

  7. Visit http://localhost:3000/

Enjoy! ๐Ÿ’™

url-shortener-microservice's People

Contributors

maribelduran avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

tinyfaces faytey

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.