Simple URL Shortener using Express and MongoDB.
- express
- moongose
- ejs
- shortid
npm install express mongoose ejs shortid- nodemon
npm install nodemon -D"scripts": {
"dev": "nodemon server.js"
},- We use
ejsto simplify html render with variables. - Each time a user "post" at
/shortUrls, Express will catch thefullUrlparameter, and then send it to the MongoDB. - In the creation process, it will create a random short id (with
shortiddependency) and save it in the cloud. - Each time a user "get" at
/, the user will recieve a list with all the urls shortered. Ejs helps with the html. - Each time a user "get" at
/:shortUrl(enters to a url shortered), the "clicks" counter will increment by 1.