beego.go
759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package beego
import {
"net"
"net/http"
"net/http/fcgi"
"log"
"strconv"
"./core"
}
type C struct {
core.Content
}
type M struct{
core.Model
}
type D struct{
core.Config
}
type U struct{
core.URL
}
type A struct{
core.Controller
}
type V struct{
core.View
}
type BeegoApp struct{
Port int
}
func (app *BeegoApp) BeeListen(port int) {
app.Port = port
err := http.ListenAndServe(":"+strconv.Itoa(app.Port), nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
func (app *BeegoApp) BeeListenFcgi(port int) {
app.Port = port
l, err := net.Listen("tcp", "127.0.0.1:"+strconv.Itoa(port))
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
fcgi.Serve(l, app.Handler)
}
func Run() {
rootPath, _ := os.Getwd()
}