From 60b1fc4ab503c5afec6179d7dccb637f8a6e037a Mon Sep 17 00:00:00 2001 From: Goodnessuc Date: Sun, 17 Sep 2023 11:58:29 +0100 Subject: [PATCH] [refactor]: refactored the README.md file to provide usage instructions --- README.md | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 77e1264..6a9a6e4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,107 @@ +# MyGoWebAppTemplate +

made-with-Go GoReportCard Go.mod version LICENSE -

# MyGoWebAppTemplate +

+ +## 🗞️ Introduction + +This is a template for initializing Go apps with the hexagonal structure according to the best practices as overviewed +through the community. + +You're going to find this useful if you're building an app that you intend to use and support over a long period of +time. + +## ⚠️ Understanding the Structure + +First, you're going to tweak this structure for your app's use case. This template simply eliminates the overhead of +manually initializing a project. + +Certainly, here's the directory explanation with clickable links for your GitHub README.md: + +1. **[cmd](./cmd)**: This directory contains the main entry point for your server application. + - **[server](./cmd/server)**: Subdirectory for the server application. + - **[main.go](./cmd/server/main.go)**: The main Go source code file for your server application. + +2. **[config](./config)**: This directory stores configuration files for your application. + - **[config.yaml](./config/config.yaml)**: Configuration settings and parameters. + +3. **[docs](./docs)**: Documentation related to your project. + - **[Getting Started.md](./docs/Getting%20Started.md)**: Instructions on how to get started with your application. + +4. **[internal](./internal)**: Contains internal application code not meant to be exposed as a public API. + - **[handlers](./internal/handlers)**: Subdirectory for request handlers. + - **[handlers.go](./internal/handlers/handlers.go)**: Code for defining and implementing request handlers. + - **[utils](./internal/utils)**: Subdirectory for utility functions. + - **[utils.go](./internal/utils/utils.go)**: Utility functions used within the application. + +5. **[scripts](./scripts)**: Contains scripts for automating various tasks. + - **[PushaG.sh](./scripts/PushaG.sh)**: A script for a task named "PushaG." + - **[creator.sh](./scripts/creator.sh)**: A script that might be related to creating something for your application. + +6. **[static](./static)**: Contains static assets like images. + - **[img.jpg](./static/img.jpg)**: An image file used in your application. + +Each of these subdirectories serves a specific purpose in organizing your application's code and resources. The +structure helps keep your codebase modular and maintainable by separating concerns and functionalities into different +directories. + +## 🏁 Getting Started + +You can use the `gonew` command or the bash [creator.sh](./scripts/creator.sh) script to initialize this project. + +### 🤩 Using Gonew + +Using `gonew` will ensure that you also get additional file and file content. Google `gonew` and check the LogRocket +blog for a tutorial I wrote on how you can use `gonew` to streamline your apps' development. + +First, Install `gonew` with this command line + +```shell +go install golang.org/x/tools/cmd/gonew@latest +``` + +Next, run this command to complete the setup with `gonew` and start building. + +```shell + +gonew -dir -v github.com/Goodnessuc/MyGoWebAppTemplate + +``` + +The command will create the exact structure of the project as is on GitHub. + +### ⚙️ Using the Bash Script + +Using the [creator.sh](./scripts/creator.sh) bash script is a fast alternative to getting started. + +The bash script also affords you more control over the contents of your app files in a minimalistic manner + +Run this command in the terminal of your project's working directory to create the directory structure and files + +```bash +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 + +``` + +You've successfully set up your project's structure with the Bash Script. + + +## 🛠️ Technologies and Tools +Go - The programming language used +GitHub Actions - GitHub CI/CD tool +Make - Build automation tool + + + +## 👏 Contributing +Contributions are welcome! Feel free to open a pull request right away. + +## 📃 License +This project is licensed under the MIT License - see the LICENSE.md file for details \ No newline at end of file