It is a library management system written in Golang using the MVC architecture.
Clone the repository. In the root use the following commands
go mod vendor
go mod tidy
- Run this command :
migrate -path database/migration/ -database "mysql://your_db_username:your_db_password@tcp(localhost:3306)/DB_NAME" -verbose up
- If this command gives error run command :
migrate -path database/migration/ -database "mysql://your_db_username:your_db_password@tcp(localhost:3306)/DB_NAME" force version
go build -o mvc ./cmd/main.go
- Run the binary file:
./mvc
Run command go test ./pkg/models
Open localhost:9000 on your browser
- Install apache2 :
sudo apt install apache2
sudo a2enmod proxy proxy_http
sudo nano your_domain_name.conf
- Copy and paste the virtual host file.
sudo a2ensite your_domain_name.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo nano /etc/hosts
Add:
127.0.0.1 your_domain_name
sudo systemctl restart apache2
sudo systemctl status apache2
Check your_domain_name on your browser
Run in the terminal to start the server.
chmod +x script/script.sh
./script/script.sh
chmod will provide the permissions to the script to run.The next command will setup the database and start the go server.