list s3 bucket
This commit is contained in:
25
src/main.go
25
src/main.go
@@ -3,9 +3,11 @@ package main
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/labstack/gommon/log"
|
||||
)
|
||||
|
||||
type Templates struct {
|
||||
@@ -29,9 +31,21 @@ func newPage() Page {
|
||||
return Page{}
|
||||
}
|
||||
|
||||
type Article struct {
|
||||
Content string
|
||||
}
|
||||
|
||||
func newArticle(content string) Article {
|
||||
return Article{
|
||||
Content: content,
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.Renderer = NewTemplates()
|
||||
|
||||
e.Logger.SetLevel(log.DEBUG)
|
||||
e.Use(middleware.Logger())
|
||||
|
||||
page := newPage()
|
||||
@@ -43,5 +57,16 @@ func main() {
|
||||
return c.Render(200, "index", page)
|
||||
})
|
||||
|
||||
e.GET("/we-are-here", 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)
|
||||
|
||||
article := newArticle(" content")
|
||||
return c.Render(http.StatusOK, "article", article)
|
||||
})
|
||||
|
||||
e.Logger.Fatal(e.Start(":54321"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user