- Install go if not installed on your machine.
- Important: Change the DB_HOST to localhost (DB_HOST=localhost) in .env and change DB_NAME to your databa
- Install neccessary Golang packages,
cd cmd
thengo install
- Run go
run cmd/main.go
. Access API using http://localhost:8080
- Just Change DB_Name to create new database, because it automatically creates a new database if it doesn't exist
- Delete auto migrate inside file cmd/main.go, line 33 if if you don't need anymore
dbBase.Debug().Migrator().AutoMigrate(&domain.Post{})
to
dbBase.Debug().Migrator().AutoMigrate()
-
I also created a db file if you want to do it manually