Skip to content

bubblehub/go-webapp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Разработка web-приложения на Golang

Quick start (easy to use)

$ git clone git@github.com:dblokhin/go-webapp.git
$ cd go-webapp/
$ GOPATH=`pwd`
$ go get github.com/dblokhin/webapp 
$ go run src/main.go

Пример использования

Добавление собственных роутеров в main.go

Application.Routes(app.MapRoutes{
			{"/one": handlers.HandleOne{}},
			{"/two": handlers.HandleWwo{}},
			{"/{url:.*}": handlers.Handle404{}},
		})

Где каждый Handle должен быть создан в src/interfaces/handlers/

import (
	app "github.com/dblokhin/webapp"
)

type HandleCustom struct {
    app.HTTPController
}

func (h HandleCustom) GET(app *app.ContextApplication) {

    doc := app.Doc.Clone("custom") // like child
    doc["TitlePage"] = "Some text value (string)"

    result := doc.Compile()
    app.Ctx.SendHTML(result)
}

About

Example of web application on Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Smarty 62.1%
  • Go 37.9%