See github.com/bsingr/golang-apache-fastcgi.
24 | 25 | 26 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | EXAMPLES_VANILLA=examples/vanilla 2 | EXAMPLES_BEEGO=examples/beego 3 | 4 | default: 5 | make deploy 6 | make run 7 | run: 8 | fig rm --force && fig build && fig up 9 | deploy: 10 | GOOS=linux GOARCH=amd64 make build 11 | cp -R ${EXAMPLES_VANILLA} web/public/ 12 | cp -R ${EXAMPLES_BEEGO} web/public/ 13 | make unpack 14 | unpack: 15 | cd web/public/vanilla && make unpack 16 | cd web/public/beego && make unpack 17 | build: 18 | cd ${EXAMPLES_VANILLA} && make pack 19 | cd ${EXAMPLES_BEEGO} && make pack 20 | bench: 21 | ab -n 5000 -c 100 -g benchmarks/static.tsv http://localdocker:80/ 22 | ab -n 5000 -c 100 -g benchmarks/vanilla.tsv http://localdocker:81/ 23 | ab -n 5000 -c 100 -g benchmarks/beego.tsv http://localdocker:82/ 24 | make graph 25 | graph: 26 | gnuplot benchmarks/graph.plot 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jens Bissinger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/beego/tests/default_test.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "net/http" 5 | "net/http/httptest" 6 | "testing" 7 | "runtime" 8 | "path/filepath" 9 | _ "golang-apache-fastcgi/examples/beego/routers" 10 | 11 | "github.com/astaxie/beego" 12 | . "github.com/smartystreets/goconvey/convey" 13 | ) 14 | 15 | func init() { 16 | _, file, _, _ := runtime.Caller(1) 17 | apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) 18 | beego.TestBeegoInit(apppath) 19 | } 20 | 21 | 22 | // TestMain is a sample to run an endpoint test 23 | func TestMain(t *testing.T) { 24 | r, _ := http.NewRequest("GET", "/", nil) 25 | w := httptest.NewRecorder() 26 | beego.BeeApp.Handlers.ServeHTTP(w, r) 27 | 28 | beego.Trace("testing", "TestMain", "Code[%d]\n%s", w.Code, w.Body.String()) 29 | 30 | Convey("Subject: Test Station Endpoint\n", t, func() { 31 | Convey("Status Code Should Be 200", func() { 32 | So(w.Code, ShouldEqual, 200) 33 | }) 34 | Convey("The Result Should Not Be Empty", func() { 35 | So(w.Body.Len(), ShouldBeGreaterThan, 0) 36 | }) 37 | }) 38 | } 39 | 40 | -------------------------------------------------------------------------------- /web/sites-enabled/default.conf: -------------------------------------------------------------------------------- 1 |Hello world from Go!
| Method | %s |
| URL | %s |
| URL.Path | %s |
| Proto | %s |
| Host | %s |
| RemoteAddr | %s |
| RequestURI | %s |
| Header | %s |
| Body | %s |
71 | Beego is a simple & powerful Go web framework which is inspired by tornado and sinatra.
72 |
73 | Official website: {{.Website}}
74 |
75 | Contact me: {{.Email}}
76 |