This API (codebse) was built to help transform long Urls into shorter Urls for use. It was built using Node.js, Express, MongoDb and CRUD functionality.
- Fundamental knowledge of Node.js, Express, MongoDb (mongoose).
- Node.js installed on your machine
- MongoDb installed on your Machine
- Basic knowledge of CRUD functionality
- You can access and/or download the technologies here:
# Get the latest snapshot
git clone https://github.com/timilehin2000/url-shortener.git
# Change directory
cd url-shortener
# Copy .env.example to .env
cp .env.variable.env variable.env
# Create a database (with MongoDB)
# Update variable.env file with database credentials
# PROD_DATABASE=mongodb://<username>:<password>@localhost/<database_name>
# DEV_DATABASE=mongodb://localhost:27017/<database_name>
# Install NPM dependencies
npm install
# Then simply start your app
- npm start (when connected to development database)
- npm run dev (when using production database)
By default, the client will listen on localhost via port 3000. which is what was duplicated from the .env.example file
Make sure post is set to x-www-form-urlencoded
- Post the long url (POST):
/api/v1/
Copy and paste the shortened url the browser
Although this is a simple and small codebase, however if you find an issue with the codebase or you have any suggestion please help out, send in a PR. I am not perfect:astronaut:.
Thanks:upside_down_face:
Timi