This project is a URL shortener API built using Node.js and Express. The purpose of this project is to practice creating a REST API and storing data on MongoDB. Each short URL created will be unique, even if the same origin URL is passed in during creation.
GET /api/v1/shorten/:shortUrl
- Retrieves the original url given the short urlGET /api/v1/shorten/:shortUrl/stats
- Retrieves the number of times this short url was retrievedPOST /api/v1/shorten
- Creates a short URL based on the original URL passed in with the body requestDELETE /api/v1/shorten/:shortUrl
- Deletes the passed in short URL's record in the DBPUT /api/v1/shorten/:shortUrl
- Updates the passed in short URL's original URL with the passed in URL in body
- Clone repo
- run
npm install
- Create .env file and Add environmental variables below
- MONGO_URI (URI of your MongoDB instance)
- PORT (Port where you want the server to be ran on, will default to 3000 if nothing is provided)
- Start up MongoDB instance if running locally
- run
npm start
to start server
This project idea is from roadmap.sh