File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 11package main
22
33import (
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}
You can’t perform that action at this time.
0 commit comments