This repository includes a minimal example of how you would implement the usage of @studiohyperdrive/shortener
in Express & Mongoose.
- MongoDB should be running on localhost:27017
npm install
: install the dependenciesnpm start
: start the application on localhost:3000
parameters: url
(the url you want to shorten)
action: responds with a shortened url
parameters: id
(the id of the url you want to unshorten)
action: redirects you to your original url
Additionally, when a shortened url is unshortened, a counter
-property is increased in the database to keep track of how many times a shortened url has been used.