diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..43fdf59 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +DB_HOST= +DB_PORT= +DB_USERNAME= +DB_PASSWORD= +DB_NAME= +SSL_MODE= diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a280e5d --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,46 @@ +name: Go + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Set up Go 1.19 + uses: actions/setup-go@v3 + with: + go-version: 1.19 + id: go + + - name: Install dependencies + run: | + go mod download + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... + + - name: Vet + run: go vet ./... + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d28dfe4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +.idea +.env +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..882396c --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2012-2023 Ukeje Chukwuemeriwo Goodness + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c65807d --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +# Makefile for the Golang project + +# Variables +BINARY_NAME=server +PACKAGE=cmd/server +DOCS_DIR=docs + +.PHONY: all build run test clean docs + +# Default target to run when executing 'make' +all: build + +# Build the project +build: + @echo "Building..." + go build -o $(BINARY_NAME) ./$(PACKAGE) + +# Run the server +run: + @echo "Running server..." + go run ./$(PACKAGE) + +# Run tests +test: + @echo "Running tests..." + go test -v ./... + +# Remove build artifacts +clean: + @echo "Cleaning up..." + go clean + rm $(BINARY_NAME) \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5ff1cd4 --- /dev/null +++ b/go.mod @@ -0,0 +1 @@ +module MyGoWebAppTemplate diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/scripts/PushaG.sh b/scripts/PushaG.sh new file mode 100755 index 0000000..7ac4e8f --- /dev/null +++ b/scripts/PushaG.sh @@ -0,0 +1,8 @@ +# helper script for pushing code to GitHub + + +git add . +echo -n "🔊 What's the commit message 👉 " +read response +git commit -m "$response" +git push origin main \ No newline at end of file diff --git a/scripts/creator.sh b/scripts/creator.sh new file mode 100644 index 0000000..e3061c8 --- /dev/null +++ b/scripts/creator.sh @@ -0,0 +1,5 @@ +# helper file for recreating the project structure without any file content + +mkdir -p cmd/server config internal/handlers internal/utils scripts static docs + +touch .gitignore LICENSE Makefile README.md Dockerfile .env.example go.mod go.sum scripts/PushaG.sh