Golang web application from book "Let’s Go", author Alex Edwards. Original code was modified with third party libraries.
List of used libraries:
- ozzo-validataion for validation
- gorilla-csrf for validation csrf tokens
- gorilla-mux for routing
- gorilla-session for session
- godotenv for reading env files
- logrus for logging
For migrations use tool migrate
- Run mysql docker image for tests (
docker-compose -f docker/docker-compose-prod.yml up
) - If it first run, wait for loading mysql and run migrate tool (
migrate -path migrations/ -database "mysql://user:pass@tcp(127.0.0.1:3307)/snippetbox" up
) make
./snippetbox
See conf.env
for environment variables or set it when app started. Example: PORT=8082 ./snippetbox
- Run mysql docker image for tests (
docker-compose -f docker/docker-compose-tests.yml up
) - If it first run, wait for loading mysql and run migrate tool (
migrate -path migrations/ -database "mysql://user:pass@tcp(127.0.0.1:3308)/snippetbox_test" up
) make test
If you want other DSN string for mysql, change variable dsnString
in pkg/models/mysql/test_helper.go