Go to file
2024-01-22 15:51:29 +02:00
src added swagger 2024-01-22 15:30:01 +02:00
test init nest 2024-01-21 10:19:18 +02:00
.dockerignore Dockerfile and docker-compose are added correctly 2024-01-22 15:21:01 +02:00
.env.example .env added 2024-01-21 14:56:22 +02:00
.eslintrc.js init nest 2024-01-21 10:19:18 +02:00
.gitignore .env added 2024-01-21 14:56:22 +02:00
.prettierrc init nest 2024-01-21 10:19:18 +02:00
docker-compose.yaml Dockerfile and docker-compose are added correctly 2024-01-22 15:21:01 +02:00
Dockerfile Dockerfile and docker-compose are added correctly 2024-01-22 15:21:01 +02:00
nest-cli.json init nest 2024-01-21 10:19:18 +02:00
package-lock.json added swagger 2024-01-22 15:30:01 +02:00
package.json added swagger 2024-01-22 15:30:01 +02:00
README.md README.md 2024-01-22 15:51:29 +02:00
swagger.ts added swagger 2024-01-22 15:30:01 +02:00
tsconfig.build.json init nest 2024-01-21 10:19:18 +02:00
tsconfig.json init nest 2024-01-21 10:19:18 +02:00

Tiny URL Microservice

The Tiny URL Microservice is a simple URL shortening service built with Nest.js. It allows users to create shortened versions of long URLs, making them easier to share. This README provides an overview of the project, how to run it, and details about available routes.

Table of Contents

Project Overview

This project is a simple URL shortening microservice built with Nest.js. It provides the following features:

  • URL Shortening: Convert long URLs into short, easy-to-share versions.
  • URL Expansion: Expand shortened URLs to their original long form And redirect users to the original URL.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js installed on your machine.
  • Docker and Docker Compose (if you prefer to use Docker).
  • .env file (if not using Docker) with the necessary environment variables. You can use .env.exmaple as a reference.

Getting Started

To get the project up and running, Choose one of the options and follow the instructions below.

1. Using Docker Compose

  docker-compose -f docker-compose.yaml up -d --build

Or

2. Using Dev Environment

run npm run start:dev to start the server.

Your Nest.js server should now be running on port as like the port from the .env file.

API Routes

Shorten URL:

  • Endpoint: POST /url-shortener/shorten
  • Request Body: { "url": "https://example.com" }
  • Response: { "data": "abc123", "status": 201 } Expand URL:

Endpoint: GET /url-shortener/:shortUrl Response: Redirects to the original long URL or redirect to the client UI 404 page if not found.

Testing

To run the tests, run the following command:

npm run test