A microservice that shortens long URLs into unique short links, resolves them back to their original destinations, supports URL creation and deletion, and was developed as a technical challenge.
- Node.js (>= 20.x)
- npm (>= 6.x)
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd url-shortener-service - Install the dependencies:
npm install
To start the development server:
npm run start:devTo build the project:
npm run buildTo start the production server:
npm startTo run tests:
npm teststart:dev: Starts the development server with hot-reloading.build: Compiles TypeScript to JavaScript and replaces paths.start: Starts the production server.lint: Lints the code using ESLint.lint:fix: Fixes linting issues using ESLint.test: Runs tests using Jest.test:watch: Runs tests in watch mode.format: Formats the code using Prettier.check-format: Checks if the code is formatted using Prettier.clean: Removes the build directory.purge: Removes the node_modules directory and clears the npm cache.prepare: Installs Husky hooks.
# Build the Docker image
docker build -t url-shortener-service .
# Run the Docker image
docker run -d --name url-shortener-container -p 8080:8080 url-shortener-service
# Check the logs
docker logs url-shortener-container
# Stop and remove the container
docker stop url-shortener-container
docker rm url-shortener-containerThis project is licensed under the MIT License.