diff --git a/README.md b/README.md index 00a13b1..5dbb86e 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,65 @@ -

- Nest Logo -

+# Tiny URL Microservice -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest +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. -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- +## Table of Contents -## Description +- [Project Overview](#project-overview) +- [Prerequisites](#prerequisites) +- [Getting Started](#getting-started) + - [Using Docker Compose](#using-docker-compose) + - [Using .env File](#using-env-file) +- [API Routes](#api-routes) +- [Testing](#testing) +- [Contributing](#contributing) +- [License](#license) -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +## Project Overview -## Installation +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, follow the instructions below. + +### Using Docker Compose + +1. Clone the repository: + + ```bash + git clone https://github.com/your-username/tiny-url-microservice.git + cd tiny-url-microservice + docker-compose -f docker-compose.yaml up -d --build + ``` + + 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: ```bash -$ npm install -``` - -## Running the app - -```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myƛliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). +npm run test +``` \ No newline at end of file