-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
66 lines (56 loc) · 1.36 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"html/template"
"log"
"net/http"
)
type Link struct {
Icon string
Title string
Url string
}
type User struct {
Avatar string
FullName string
Bio string
Links map[string][]Link
}
const avatar string = "https://pbs.twimg.com/profile_images/1746251896124219392/MGtCrEuI_400x400.jpg"
const fullName string = "Ismail Boularbah"
const bio string = "Hope is no strategy, Writing @typescript and @golang"
var links = map[string][]Link{
"link": {
{
Icon: "https://cdn-icons-png.flaticon.com/128/1051/1051326.png",
Title: "GitHub",
Url: "https://github.com/boularbahsmail",
},
{
Icon: "https://cdn-icons-png.flaticon.com/128/5968/5968958.png",
Title: "Twitter/X",
Url: "https://twitter.com/boularbahsmail",
},
{
Icon: "https://cdn-icons-png.flaticon.com/128/1006/1006771.png",
Title: "Official Website",
Url: "https://ismailium.vercel.app",
},
},
}
func homePage(writer http.ResponseWriter, request *http.Request) {
// Rendering and serving HTML template
tmpl := template.Must(template.ParseFiles("./template/index.html"))
user := User{
Avatar: avatar,
FullName: fullName,
Bio: bio,
Links: links,
}
tmpl.Execute(writer, user)
}
func main() {
fmt.Println("Server running on PORT 8000...")
http.HandleFunc("/", homePage)
log.Fatal(http.ListenAndServe(":8000", nil))
}