Build a full stack JavaScript app that is functionally similar to this: https://url-shortener-microservice.freecodecamp.rocks.
- This is a URL shortener microservice that takes a URL and returns a shortened URL.
- Express.js
- Node.js
- nodemon
- TypeScript, tsc
This is a URL shortener microservice.
-
You can
POST
a URL to/api/shorturl
and get aJSON
response withoriginal_url
andshort_url
properties. Here's an example:{ original_url : 'https://freeCodeCamp.org', short_url : 1 }
-
When you visit
/api/shorturl/<short_url>
, you will be redirected to the original URL. -
If you pass an invalid URL that doesn't follow the valid
http://www.example.com
format, theJSON
response will contain{ error: 'invalid url' }
MIT | webdev@vcoles.com