get at least something to show for today

This commit is contained in:
Darko Luketic 2017-02-10 22:15:39 +01:00
parent 9ae93fd26a
commit d63dba41a8

14
main.go
View File

@ -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
}