Skip to content

A simple backend application that creates short URLs based on long URLs provided by the user. The service is built using TypeScript, Node.js, and Express.

Notifications You must be signed in to change notification settings

carlosbertoncelli/url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Short URL Service

A simple backend application that creates short URLs based on long URLs provided by the user. The service is built using TypeScript, Node.js, and Express.

Features

  • Create short URLs based on long URLs
  • Redirect to the long URL when accessing the short URL
  • API documentation with Swagger UI

Project Structure

url-shortener/
│
├── src/
│ ├── __tests__/
│ │ └── services/
│ │ │ └── ShortUrlService.test.ts
│ ├── controllers/
│ │ └── ShortUrlController.ts
│ ├── services/
│ │ │ └── ShortUrlService.ts
│ ├── application.ts
│ └── server.ts
├── package.json
└── tsconfig.json

Getting Started

Prerequisites

  • Node.js (v14 or newer)

Installation

  1. Clone the repository

  2. Install the dependencies:

cd url-shortener
npm install

Running the Application

To start the development server, run:

npm run dev

The server will start on port 3000. You can access the API documentation at http://localhost:3000/docs.

Running Tests

To run the unit tests, use the following command:

npm jest

API Endpoints

  • POST /short-url - Create a short URL from the provided long URL
  • GET /{id} - Redirect to the long URL associated with the provided tiny URL ID

License

This project is licensed under the MIT License.

About

A simple backend application that creates short URLs based on long URLs provided by the user. The service is built using TypeScript, Node.js, and Express.

Resources

Stars

Watchers

Forks