renderer added, storage + renderer interfaces renamed to Interface

This commit is contained in:
2017-02-11 20:36:01 +01:00
parent d63dba41a8
commit e92d895690
13 changed files with 130 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/dalu/wiki/wiki/storage/mongo"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"github.com/dalu/wiki/wiki/template"
)
func main() {
@@ -25,15 +26,17 @@ func main() {
log.Fatal("initializeWiki: ", e.Error())
}
renderer := template.New(true)
mux := http.NewServeMux()
wikiHandler := wiki.NewWikiHandler(mongostore, log)
wikiHandler := wiki.NewWikiHandler(mongostore, renderer, log)
mux.Handle(wiki.DefaultMountPath, http.StripPrefix(wiki.DefaultMountPath, wikiHandler))
log.Fatal(http.ListenAndServe(":8080", mux))
}
func initializeWiki(s storage.WikiStorage) error {
func initializeWiki(s storage.Interface) error {
_, e := s.GetTermByName("")
if e != nil {
if e == mgo.ErrNotFound {