home page layout

This commit is contained in:
Ruidy Nemausat 2020-03-14 19:01:24 +01:00
parent 7d66d09abf
commit 5ffc5224c4
5 changed files with 24 additions and 5 deletions

View file

@ -5,7 +5,6 @@ import (
"log"
"net/http"
"regexp"
"strconv"
"github.com/rjNemo/go-wiki/model"
)
@ -23,8 +22,9 @@ func RegisteredRoutes() {
log.Fatal(server(Port))
}
func server(p int) error {
port := ":" + strconv.Itoa(p)
func server(p string) error {
port := ":" + p
// strconv.Itoa(p)
return http.ListenAndServe(port, nil)
}

View file

@ -1,4 +1,19 @@
package controller
var Port int = 8080
import (
"log"
"os"
"github.com/joho/godotenv"
)
var Port string = readEnv(".env")
var tmplDir string = "templates/"
func readEnv(f string) string {
err := godotenv.Load(".env")
if err != nil {
log.Fatal("Error loading .env file")
}
return os.Getenv("PORT")
}

2
go.mod
View file

@ -1,3 +1,5 @@
module github.com/rjNemo/go-wiki
go 1.14
require github.com/joho/godotenv v1.3.0

View file

@ -8,6 +8,7 @@ import (
)
func main() {
fmt.Printf("Start Go-wiki server on http://localhost:%d at %s\n", controller.Port, time.Now())
fmt.Printf("Start Go-wiki server on http://localhost:%s at %s\n", controller.Port, time.Now())
controller.RegisteredRoutes()
}

View file

@ -13,6 +13,7 @@
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous"
/>
<nav>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">