Skip to content

Commit

Permalink
fix: load default html from Html function in server
Browse files Browse the repository at this point in the history
  • Loading branch information
mertssmnoglu committed Jun 14, 2024
1 parent a639a9f commit a98f338
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internals/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

func Start(port uint16, filePath string) {
// Default port is 8080
if port == 0 {
port = 8080
}
Expand Down Expand Up @@ -54,13 +55,8 @@ func Start(port uint16, filePath string) {
}

func Markdown(filePath string) func(w http.ResponseWriter, r *http.Request) {
const mdTemplatePath = "internals/server/views/md.html"

html := Html()
markdownContent := mdtohtml.MarkdownToHtml(mdtohtml.LoadMdFile(filePath))
html, htmlReadErr := os.ReadFile(mdTemplatePath)
if htmlReadErr != nil {
log.Fatal(htmlReadErr)
}
fullHTML := fmt.Sprintf(string(html), markdownContent)

return func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit a98f338

Please sign in to comment.