Skip to content

Project template for creating web applications in Go, with a relational database backend and example content.

License

Notifications You must be signed in to change notification settings

bartvanbenthem/gofound-webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gofound-webapp

Project template for creating web applications in Go, with example database & content.

  • Routing & middleware
  • HTTP session management
  • User registration & authentication
  • Database backend (SQL)
  • Templating & forms

Used packages

  • github.com/alexedwards/scs/mysqlstore
  • github.com/alexedwards/scs/v2
  • github.com/go-playground/form/v4
  • github.com/go-sql-driver/mysql
  • github.com/julienschmidt/httprouter
  • github.com/justinas/alice
  • github.com/justinas/nosurf
  • golang.org/x/crypto

Clone repo

git clone https://github.com/bartvanbenthem/gofound-webapp.git
cd gofound-webapp

Start MySQL Database

cd project
docker-compose up -d
cd ..

Build & start the WebServer

go test -vet=off -v ./cmd/web/

go build -o ./bin/gofoundweb ./cmd/web/

./bin/gofoundweb --addr=":4000" \
                 --dsn="web:pass@/gofound?parseTime=true" \
                 --smtp-host="localhost" \
                 --smtp-port="1025" \
                 --smtp-user="" \
                 --smtp-password="" \
                 --mail-address="mail@gofound.nl" \
                 --cert="./tls/cert.pem" \
                 --key="./tls/key.pem"

Test SendMail

Start MailHog to test mail capabillities

$ go get github.com/mailhog/MailHog
$ ~/go/bin/MailHog

Test login

Use the provisioned user:

create self signed certificates

cd tls
go run /usr/local/go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost