diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0fc7196 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +PROJECT_NAME:= kitty-facty + +.PHONY: all +all: help + +.PHONY: help +help: + @echo "------------------------------------------------------------------------" + @echo "${PROJECT_NAME}" + @echo "------------------------------------------------------------------------" + @grep -E '^[a-zA-Z0-9_/%\-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: serve +serve: ## Run locally + npm run dev + +.PHONY: build +build: lint ## Build application binaries + npm run build + +.PHONY: lint +lint: ## Run linters + npm run lint + +.PHONY: test +test: lint ## Run unit tests + npm run test + +.PHONY: image +image: ## Create Docker image + docker build -t kitty-facty . + +.PHONY: docker-up +docker-up: ## Start docker image + docker run -p 3000:3000 kitty-facty diff --git a/README.md b/README.md index 63bca10..d8696d9 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ GET /api/facts?perPage=3&page=21&sortByLength=desc&sortByAlphabet=asc&maxLength= ### **Sample Response** -```bash +```javascript HTTP/1.1 200 OK Content-Type: application/json @@ -91,8 +91,8 @@ Content-Type: application/json To run tests: -```javascript -npm run test +```bash +make test ``` ## Docker @@ -102,13 +102,13 @@ To build and run the application using Docker: - Build the Docker image: ```bash -docker build -t kitty-facty . +make build ``` - Run the Docker container: ```bash -docker run -p 3000:3000 kitty-facty +make docker-up ``` ## License