The Doghouse service is a user-friendly REST API that enables users to create and view dogs effortlessly. Users can create a new dog by providing basic information like weight and color, and the service allows users to view all existing dogs on a list. The service is straightforward to use and provides a convenient way to manage and view dogs
To begin using this service, you will need to provide the required configuration in a .env
file:
NODE_ENV = "development"
POSTGRES_USER = "username"
POSTGRES_PASSWORD = "password"
POSTGRES_HOST = "host"
POSTGRES_DB = "database_name"
DATABASE_URL = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}"
THROTTLE_TTL = 60
THROTTLE_LIMIT = 10
Note - Make sure to substitute the placeholders with your own configuration
To run this service on your local computer, please follow these steps:
- Firstly, install all dependencies by using pnpm:
$ pnpm install --frozen-lockfile
- Next, Migrate the PostgreSQL database by typing the following command in your terminal:
$ pnpm migrate --url $DATABASE_URL
Warning If
$DATABASE_URL
is empty then try to paste variable manualy
- Finally, start the Nest.js server by entering the following command:
$ pnpm start:development
Note - If you want to activate watch mode for the server, simply add the
--watch
flag
Alternatively, you can run the service in a Docker container with the following command:
$ docker compose -f docker/docker-compose.yaml up -d --build
Note - Replace
POSTGRES_HOST
from "localhost" to "postgres" in Docker container
Our service also offers integration tests, which can be run using a single command:
$ pnpm test:integration
Note - You can also generate code coverage using the
--coverage
flag
The MIT License (MIT) 2023 - camelopard187. Please have a look at the LICENSE.md for more details