Initial commit.

This commit is contained in:
2021-08-30 22:10:47 -05:00
commit f572586dde
3 changed files with 51 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package main
import (
"database/sql"
_ "encoding/json"
"fmt"
"net/http"
_ "github.com/lib/pq"
)
func main() {
http.HandleFunc("/data", get)
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic(err)
}
}
func get(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadGateway)
w.Write([]byte("Hell world!"))
}
func sql_test() {
psqlInfo := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", "localhost", 5432, "postgres", "", "inventory")
db, err := sql.Open("postgres", psqlInfo)
if err != nil {
panic(err)
}
defer db.Close()
rows, err := db.Query("")
if err != nil {
panic(err)
}
defer rows.Close()
}
+5
View File
@@ -0,0 +1,5 @@
module copyrightcrusader.org/inv
go 1.16
require github.com/lib/pq v1.10.2 // indirect
+2
View File
@@ -0,0 +1,2 @@
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=