-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (36 loc) · 808 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
40
41
42
43
44
45
46
47
// package main
// import (
// "log"
// )
// func main() {
// store, err := NewPostgresStore()
// if err != nil {
// log.Fatal(err)
// }
// if err := store.Init(); err != nil {
// log.Fatal(err)
// }
// server := NewAPIServer(":3000", store)
// server.Run()
// }
// main.go
package main
import (
"fmt"
"net/http"
)
func main() {
hello()
// Define a handler function for handling incoming requests
handler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, World!")
}
// Register the handler function for the root ("/") path
http.HandleFunc("/", handler)
// Start the server and listen on port 8080
fmt.Println("Server listening on :8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
fmt.Printf("Error starting server: %v\n", err)
}
}