This is the famous tiny url project where users can get shortUrls for longUrls.
- Appserver : POC for users for everything - registering long url and redirecting to long url
- KeyDb : Offline Service which generates shortUrlIds that AppServer can reuse
Everything is in nodeJs (JS is everywhere :P)
- brew services start mongodb-community@4.4
- Make a new table named tinyurl and key-db using mongo client (e.g.
use tinyurl
)
- cd AppServer
- npm install
- npm run dev Will start the server on port 3000
- cd KeyDb
- npm install
- npm run dev Will start the server on port 3001
- http://localhost:3000/api/:longUrl => Returns registered shortUrl
- http://localhost:3000/api/ with body(json)
{"longUrl": "https://github.com/shah-anurag/tiny-url"}
=> For registering a longUrl - http://localhost:3001/shortUrlId => Only supports GET requests to get a short URL