GithubHelp home page GithubHelp logo

denisediniz / url-shortener Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 343 KB

Microservice to shorten URLs.

Home Page: https://url-shortener-dd.glitch.me/

License: MIT License

JavaScript 39.34% HTML 60.66%

url-shortener's Introduction

URL Shortener Microservice

Microservice to shorten URLs. Powered by Express and MongoDB+Mongoose.

How it works

  • POST a URL to /api/shorturl/new and receive a shortened URL in the JSON response. Example : {"original_url":"www.google.com","short_url":1};
  • If you pass an invalid URL that doesn't follow the http(s)://www.example.com(/more/routes) format, the JSON response will contain an error like {"error":"invalid URL"};
  • When you visit the shortened URL it will redirect you to your original link.

Example Usage

/api/shorturl/1 will redirect to https://www.google.com/

Installation

  1. git clone [PASTE_URL_HERE]
  2. cd url-shortener
  3. npm install

You must have MongoDB locally installed and running. If you prefer a cloud database just replace the url in package.json. Then:

Development: npm run dev

Production: npm start

*production note: you must set your DATABASE_URL in .env file.

url-shortener's People

Contributors

denisediniz avatar

Watchers

 avatar  avatar

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.