From d63dba41a88a356a517d24c1bf1dd5a175311ea3 Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Fri, 10 Feb 2017 22:15:39 +0100 Subject: [PATCH] get at least something to show for today --- main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index af1645b..acfbac1 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "net/http" + "time" "github.com/Sirupsen/logrus" "github.com/dalu/wiki/wiki" @@ -25,8 +26,8 @@ func main() { } mux := http.NewServeMux() - wikiHandler := wiki.NewWikiHandler(mongostore, log) + wikiHandler := wiki.NewWikiHandler(mongostore, log) mux.Handle(wiki.DefaultMountPath, http.StripPrefix(wiki.DefaultMountPath, wikiHandler)) log.Fatal(http.ListenAndServe(":8080", mux)) @@ -45,12 +46,23 @@ func initializeWiki(s storage.WikiStorage) error { t2.Language = "en" t2.Name = "Main Page" t2.Slug = "Main_Page" + r := new(storage.Revision) + r.ID = bson.NewObjectId() + r.PublishDate = time.Now() + r.AuthorIP = "127.0.0.1" + r.TermID = t2.ID.Hex() + r.Text = "# Main Page" + t2.CurrentRevisionID = r.ID.Hex() if e := s.CreateTerm(t1); e != nil { return e } if e := s.CreateTerm(t2); e != nil { return e } + + if e := s.CreateRevision(r); e != nil { + return e + } } else { return e }