Skip to content

volkanoztoklu/MovieBox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

158 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Project

Starting the Web Application

Frontend Only

Make sure you have npm installed, and working on the ./frontend/ directory.

Use the following command to download neccessary dependancies for Vue frontend:

npm install

Compile and hot-reload for frontend

npm run dev

Compile and build for frontend (required for Frontend+Backend)

npm run build

This command generated all the frontend to compiled assets. It makes it possible to host a web server with just these files alone. Frontend+Backend serves these build files alongside the backend.

Lint with ESLint

npm run lint

Frontend + Backend (Backend Only)

To start the web appliaction with the static build files generated by Vue alongside the backend, make sure you have Go 1.18 or higher installed, and run:

go run main.go

With this way, the backend API will start routing its own routes, and also serve static build files generated by Vue on the /frontend/dist/ directory. If there is no build files in that directory, you will get a 404, but you are still able to work with backend only.

Backend Live Server

First, we are going to install air.

go install github.com/cosmtrek/air@latest

Next, we need to configure Air for our Golang project. You can do that by running the following command:

air init

This will create a air.toml file that will contain the default configurations for Air. Here is an example of what that looks like:

root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
  bin = "./tmp/main"
  cmd = "go build -o ./tmp/main ."
  delay = 1000
  exclude_dir = ["assets", "tmp", "vendor", "testdata"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  full_bin = ""
  include_dir = []
  include_ext = ["go", "tpl", "tmpl", "html"]
  kill_delay = "0s"
  log = "build-errors.log"
  send_interrupt = false
  stop_on_error = true

[color]
  app = ""
  build = "yellow"
  main = "magenta"
  runner = "green"
  watcher = "cyan"

[log]
  time = false

[misc]
  clean_on_exit = false

[screen]
  clear_on_rebuild = false

Next, let me highlight a few notable configurations you might care about and might want to update for your project.

Under build in the air.toml; you might want to change the cmd property. If the entry of your golang application is in a different directory, say server, you can change the property to something like this:

cmd = "go build -o ./tmp/main ./server/main.go"

Finally, the only part that is remaining is running our Golang application using Air. You can do this by running the air command:

air

Project Team

This project started as a COMP305 Database Management Systems Project for the following members.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors