https://github.com/armen/gapp
GAPP aims to eliminate the gapp between gorilla and a real world web application
https://github.com/armen/gapp
Last synced: 7 months ago
JSON representation
GAPP aims to eliminate the gapp between gorilla and a real world web application
- Host: GitHub
- URL: https://github.com/armen/gapp
- Owner: armen
- Created: 2013-01-18T15:02:20.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-13T16:12:29.000Z (over 12 years ago)
- Last Synced: 2025-01-12T10:29:45.542Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 605 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GAPP
## First application with GAPP
Create a directory in src/ and name your application (e.g. app)
mkdir src/app
Then create it's main file (e.g. src/app/app.go)
```go
package mainimport (
"github.com/gorilla/mux""flag"
"fmt"
"gapp"
"log"
"net/http"
"os"
)var (
flagConf = flag.String("conf", "conf/app.ini", "Configuration file")
Usage = func() {
fmt.Fprintf(os.Stderr, "Usage:\n\t--conf Configuration file (e.g --conf conf/app.ini)\n")
}
)func main() {
flag.Usage = Usage
flag.Parse()gapp.Init(*flagConf, nil)
r := mux.NewRouter()
r.Handle("/", gapp.Handler(gapp.HomeHandler)).Methods("GET")
r.Handle("/signin", gapp.SigninHandler).Methods("GET")
r.Handle("/signout", gapp.SignoutHandler).Methods("GET")
r.Handle("/google-signin", gapp.GoogleSigninHandler).Methods("POST")
r.Handle("/google-callback", gapp.GoogleCallbackHandler).Methods("GET")
r.Handle("/{page}", gapp.PageHandler).Methods("GET")http.Handle("/", r)
err := http.ListenAndServe(gapp.Address, nil)if err != nil {
log.Fatal(err)
}
}
```Now build the application (e.g app)
make
go get appAnd run it
./bin/app