To start the application, follow these steps:
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Set up the environment variables by creating a
.env
file based on the provided.env.example
. -
Build and run the application using the following commands:
go build ./cmd/user-api
./user-api
- Access the application at the specified port (configurable via environment variables) and explore the defined API routes.
To perform a clean build, you can use the following commands:
go clean -i ./...
go mod tidy
go mod download
go build ./...
go run cmd/user-api/main.go
This command starts the Go application, and it should be accessible at http://localhost:8080.
To rerun tests without using the cache, you can use the -count flag with the go test command. The -count flag specifies the number of times to run the tests. By setting it to 1, you ensure that the tests are not cached. Here's the command:
go test -count=1 ./internal/app/test/...
To generate swagger doc
swag init -g cmd/user-api/main.go
Notes: kindly change the DB_URL according to your need it's currently set only for docker