-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 868 Bytes
/
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
package main
import (
"log"
"net/http"
)
func homePage(w http.ResponseWriter, r *http.Request) {
// Render the home html page from static folder
http.ServeFile(w, r, "static/home.html")
}
func coursePage(w http.ResponseWriter, r *http.Request) {
// Render the course html page
http.ServeFile(w, r, "static/courses.html")
}
func aboutPage(w http.ResponseWriter, r *http.Request) {
// Render the about html page
http.ServeFile(w, r, "static/about.html")
}
func contactPage(w http.ResponseWriter, r *http.Request) {
// Render the contact html page
http.ServeFile(w, r, "static/contact.html")
}
func main() {
http.HandleFunc("/home", homePage)
http.HandleFunc("/courses", coursePage)
http.HandleFunc("/about", aboutPage)
http.HandleFunc("/contact", contactPage)
err := http.ListenAndServe("0.0.0.0:8080", nil)
if err != nil {
log.Fatal(err)
}
}