Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Jan 9, 2024
1 parent 5b7f5e6 commit 9319c02
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion ctp-highlightjs-theme.css

This file was deleted.

12 changes: 1 addition & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,21 @@ import (

"isabelroses.com/pages"

"github.com/joho/godotenv"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)

// Template Type
type Template struct {
templates *template.Template
}

// Template Render function
func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
return t.templates.ExecuteTemplate(w, name, data)
}

func main() {
godotenv.Load(".env")

// Initialize router
e := echo.New()

// Middlewares
e.Use(middleware.Logger())
e.Use(middleware.RequestID())
e.Use(middleware.Secure())
Expand All @@ -36,22 +29,19 @@ func main() {
}))
e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(69)))

// Template Parsing
t := &Template{
templates: template.Must(template.ParseGlob("templates/**/*.html")),
}

e.Renderer = t

// // Static server
e.Static("/public", "public")

// Page routes
e.GET("/", pages.Home)
e.GET("/projects", pages.Projects)
e.GET("/projects/*", pages.Projects)
e.GET("/blog", pages.Blog)
e.GET("/blog/:post", pages.Post)
e.GET("/blog/:slug", pages.Post)

e.Logger.Fatal(e.Start(":3000"))
}

0 comments on commit 9319c02

Please sign in to comment.