This CLI tool shortens URLs using a MongoDB database for storage. It uses Express.js for the API, Zod for URL schema validation, and Python's argparse module for the CLI interface. Sensitive information is stored in environment variables and a config file.
- Clone the repository:
git clone https://github.com/frumptiousclone/url-shortener-cli-tool.git
- Install dependencies:
npm install
- Rename
.env.example
to.env
and fill in the required environment variables. - Edit
config.js
to customize settings like port and database URL.
-
Shorten a URL:
python urlshortner/cli/cli.py <url-to-shorten>
-
Start the Express server:
npm start
POST /url-shortner
: Shorten a URLGET /:key
: Redirect to the original URL
This project is licensed under the ISC License.