Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.04 KB

Readme.md

File metadata and controls

48 lines (33 loc) · 1.04 KB

Node.js URL Shortener

A simple Node.js URL shortener using ExpressJS and MongoDB.

Installation

  1. Clone the repository:

    git clone https://github.com/mohamadayash22/node-url-shortener.git
  2. Install the project dependencies

     cd node-url-shortener
     npm install
  3. Configure the environment variables

     PORT=3000
     MONGODB_URI=your-mongodb-uri
     BASE_URL=your-api-base-url
  4. To run the app in dev mode

    npm run dev
  5. To run the app in production mode

    npm start

Usage

To use the URL shortener API, make HTTP requests to the following endpoints:

  • POST /api/shorten: Shorten a long URL.
  • GET /{urlId}: Redirect to the original URL.

API Documentation

For detailed information about the available API endpoints, please refer to the BASE_URL/api-docs , where BASE_URL is your API's base URL as configured in your environment file.

You can access the Swagger documentation by replacing BASE_URL with the actual base URL of your API.