Skip to content

Latest commit

 

History

History
 
 

controllers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Controllers

This is generated by Beego framework after running bee new seagul. There're controllers of back-end server which are responsible for rendering a HTML file or processing API requests.

Default.go

This is generated to render a simple page to the browser. We keep it because we use Beego as a web server.

But this is quite simple when we use AngularJS as the front-end framework. The MainController in default.go just needs to render one HTML file in the whole website.

Here's almost all the code of it.

func (this *MainController) Get() {
  this.TplName = "index.html"
  this.Render()
}

Dockerapi.go

This is another controller for seagull to process API request about docker.

It will not render a whole HTML file and just return JSON data or pure string.

The code of Dockerapi.go is as simple as the previous one.

/* Wrap docker remote API to get version info */
func (this *DockerapiController) GetVersion() {
  address := "/version"
  result := RequestUnixSocket(address, "GET")
  this.Ctx.WriteString(result)
}

Then the front-end framework or other processes and get the data from thess APIs.