- Clone the repo. From the root directory:
- go mod vendor
- go mod tidy
- MYSQL:
mysql -u root -p
: and enter password- Create a new database 'books':
CREATE DATABASE books;
- Connect to the database:
USE books;
- Import the sql dump file into your database:
mysql -u root -p books < dump.sql
- Running the server:
go build -o mvc ./cmd/main.go
- Run the binary file:
./mvc
- Hosting
- Install apache2:
sudo apt install apache2
sudo a2enmod proxy proxy_http
cd /etc/apache2/sites-available
sudo nano mvc.sdslabs.local.conf
Add:
<VirtualHost *:80>
ServerName mvc.sdslabs.local
ServerAdmin rohith@gmail.com
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
TransferLog /var/log/apache2/mvc_access.log
ErrorLog /var/log/apache2/mvc_error.log
</VirtualHost>
sudo a2ensite mvc.sdslabs.local.conf
- add
127.0.0.1 mvc.sdslabs.local
to/etc/hosts
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl restart apache2
sudo systemctl status apache2
- Check mvc.sdslabs.local on your browser