Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 723 Bytes

README.md

File metadata and controls

22 lines (17 loc) · 723 Bytes

API Project: URL Shortener Microservice

About

This is a simple URL shortener project

Endpoints:

Endpoints Description
POST /api/shorturl/new Register a URL and create a short URL for it
GET /api/shorturl/{short_url} Redirect to the original URL previously registered

Example output:

  • {"original_url":"https://freecodecamp.org","short_url":"1904412960"}
  • {"error":"invalid url"}

How to use:

Be sure to change the uri variable in database.js according to your own MongoDB server. It's also possible to just create a .env file and store this information there in order to keep it hidden and safe. Then, just run on terminal:

npm install
npm start