Skip to content

Commit 6dea37c

Browse files
committed
updated routes
1 parent 29ebb13 commit 6dea37c

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

main.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
package main
22

33
import (
4+
"log"
5+
"net/http"
6+
47
_ "github.com/lib/pq"
58
)
69

7-
func main() {
10+
// func query_handler() {
11+
12+
// query_string := "SELECT \"ResId\", \"ResName\" FROM tbl_dk_resource"
13+
// query_string = "SELECT * FROM tbl_dk_res_category"
14+
// do_db_query(query_string)
815

9-
query_string := "SELECT \"ResId\", \"ResName\" FROM tbl_dk_resource"
10-
query_string = "SELECT * FROM tbl_dk_res_category"
11-
do_db_query(query_string)
16+
// }
1217

13-
// fmt.Println(response)
18+
type server struct{}
1419

20+
func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
21+
w.Header().Set("Content-Type", "application/json")
22+
w.WriteHeader(http.StatusOK)
23+
w.Write([]byte(`{"message": "hello world"}`))
24+
}
25+
26+
func main() {
27+
s := &server{}
28+
http.Handle("/", s)
29+
log.Fatal(http.ListenAndServe(":8080", nil))
1530
}

0 commit comments

Comments
 (0)