https://github.com/denisecase/go-hunt-sql
Example app to learn Go (golang)
https://github.com/denisecase/go-hunt-sql
app go golang rest
Last synced: about 1 year ago
JSON representation
Example app to learn Go (golang)
- Host: GitHub
- URL: https://github.com/denisecase/go-hunt-sql
- Owner: denisecase
- Created: 2020-12-24T19:15:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-27T18:52:12.000Z (over 5 years ago)
- Last Synced: 2023-03-02T15:22:56.862Z (over 3 years ago)
- Topics: app, go, golang, rest
- Language: Go
- Homepage: https://go-hunt-sql.herokuapp.com/
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Hunt (with relational db)
> Go with the [Iris framework](https://github.com/kataras/iris)
## Links
- [Project Source]()
- []()
## Stack
- Go - programming language, also referrred to as golang
- Gorilla Mux - HTTP routing and URL matcher
- JWT - JSON web tokens for authentication & authorization
- [GORM](https://gorm.io/) - Golang object-relational mapper layer (facilitates changing datastore)
- Postgres - relational datastore for production
- SQLite3 - relational datastore for development
- MinGW (optional) - gcc for Windows (needed for SQLite3 on Windows)
## Prerequisites
- Install golang, postgresql, and mingw (for SQLite3)
```Powershell
choco install golang -y
choco install postgresql -y
choco install mingw -y
```
Default $GOPATH is C:\Go.
Optional: Periodically run `choco upgrade all -y` to keep packages current.
## Common Go Commands
```
go // list options
go version
go help
go fmt
go mod tidy // clean up unneeded dependencies
go get -u -t ./... // update all versions
go get "html/template" // get a specific package
```
## Initialize Project (go mod init)
From within this project folder assign a globally unique name to your project
(use your username and repo name in the command below):
```Powershell
go mod init github.com/denisecase/go-hunt-sql
```
This will create an editiable go.mod file (lists dependencies like package.json)
and a autogenerated go.sum file (lists checksums)
in the root folder of the project repo.
## Build Project
```Powershell
gofmt -s -w .
go build
```
## Run Project (Includes Build)
```Powershell
go run app.go
```
If it asks about running autofix, select Y.
If Windows asks about allowing access, click Private / unclick Public.
View at
## Reference
- [Form Validation and Processing in Go](https://www.alexedwards.net/blog/form-validation-and-processing)
- [CRUD RESTful API with Go, GORM, JWT, Postgres, Mysql, and Testing by Victor Steven](https://levelup.gitconnected.com/crud-restful-api-with-go-gorm-jwt-postgres-mysql-and-testing-460a85ab7121)
- [repo](https://github.com/victorsteven/Go-JWT-Postgres-Mysql-Restful-API)
- [Gin backend](https://github.com/victorsteven/Forum-App-Go-Backend)
- [Gin frontend (React)](https://github.com/victorsteven/Forum-App-React-Frontend)
## Learn Go
- [Golang.org/doc](https://golang.org/doc/)
- [BOOK: Introducing Go: Build Reliable, Scalable Programs 1st Edition by Caleb Doxsey ](https://www.amazon.com/Introducing-Go-Reliable-Scalable-Programs/dp/1491941952)
- [BOOK: Go Programming Language by Donovan and Kernighan](https://www.gopl.io/)
- [RESOURCES: Idomatic Go by Damian Gryski](https://medium.com/@dgryski/idiomatic-go-resources-966535376dba)
- [Effective Go](https://golang.org/doc/effective_go.html)
- [Go by Example](https://gobyexample.com/)
- [Go Advice](https://github.com/cristaloleg/go-advice)
- [Search for packages](https://pkg.go.dev/)
- [Create projects independent of $GOPATH using Go Modules](https://medium.com/mindorks/create-projects-independent-of-gopath-using-go-modules-802260cdfb51)