remove blog
This commit is contained in:
27
src/main.go
27
src/main.go
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -11,7 +10,6 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/russross/blackfriday/v2"
|
||||
"golang.org/x/net/websocket"
|
||||
)
|
||||
|
||||
@@ -39,20 +37,11 @@ func newPage(boxes map[int]bool) Page {
|
||||
}
|
||||
}
|
||||
|
||||
type Article struct {
|
||||
Content template.HTML
|
||||
}
|
||||
|
||||
func newArticle(content template.HTML) Article {
|
||||
return Article{
|
||||
Content: content,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
wsConnections = make(map[*websocket.Conn]bool)
|
||||
wsMutex sync.Mutex
|
||||
boxes = make(map[int]bool, 1000)
|
||||
e = echo.New()
|
||||
)
|
||||
|
||||
func broadcastMessage(message string) {
|
||||
@@ -67,7 +56,6 @@ func broadcastMessage(message string) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.Renderer = NewTemplates()
|
||||
|
||||
e.Logger.SetLevel(log.DEBUG)
|
||||
@@ -86,19 +74,6 @@ func main() {
|
||||
return c.Render(200, "index", page)
|
||||
})
|
||||
|
||||
e.GET("/blog", func(c echo.Context) error {
|
||||
// Log a test message
|
||||
e.Logger.Info("Test log: /we-are-here endpoint called")
|
||||
|
||||
msg := getNotes(c, e.Logger)
|
||||
e.Logger.Info(msg)
|
||||
|
||||
htmlContent := blackfriday.Run([]byte(msg))
|
||||
|
||||
article := newArticle(template.HTML(string(htmlContent)))
|
||||
return c.Render(http.StatusOK, "article", article)
|
||||
})
|
||||
|
||||
e.GET("/ws", initWs)
|
||||
|
||||
e.Logger.Fatal(e.Start(":54321"))
|
||||
|
||||
Reference in New Issue
Block a user