gin nodemon github
Install Go: Download and install the Go programming language from the official website: https://golang.org/dl/
Create a Go Module: In your project directory, run the following command to initialize a Go module.
go mod init <module-name>
Install Gin: Use the following command to install the Gin web framework.
go get -u github.com/gin-gonic/gin
Create a main.go file: Create a file named
main.go
in your project directory and import the necessary packages. ```go package main
import "github.com/gin-gonic/gin"
func main() { r := gin.Default() // Define your routes and handlers here r.Run(":8080") } ```
Install Nodemon: Install Nodemon globally using npm.
npm install -g nodemon
Create a nodemon.json file: Create a file named
nodemon.json
in your project directory with the following configuration.json { "watch": ["main.go"], "ext": "go", "exec": "go run main.go" }
Start the Application with Nodemon: Run the following command to start your Go application using Nodemon.
nodemon
Verify the Setup: Access your application in a web browser or using tools like curl to ensure it is running on http://localhost:8080.
(Optional) Initialize a Git Repository: If not already initialized, run the following commands to initialize a Git repository.
git init git add . git commit -m "Initial commit"
(Optional) Create a GitHub Repository: Create a new repository on GitHub and follow the instructions to push your code to the remote repository.
git remote add origin <repository-url> git push -u origin master