improve logging
This commit is contained in:
7
main.go
7
main.go
@@ -8,8 +8,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
_ "modernc.org/sqlite"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
_ "modernc.org/sqlite"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -17,7 +17,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("hello, world!")
|
fmt.Println("ugh. can i go back to eep?")
|
||||||
var err error
|
var err error
|
||||||
db, err = sql.Open("sqlite", "./db/notes.db")
|
db, err = sql.Open("sqlite", "./db/notes.db")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -45,7 +45,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", "text/json")
|
w.Header().Add("Content-Type", "text/json")
|
||||||
fmt.Fprint(w, string(jsonString))
|
fmt.Fprint(w, string(jsonString))
|
||||||
fmt.Println(string(jsonString))
|
// fmt.Println(string(jsonString))
|
||||||
})
|
})
|
||||||
|
|
||||||
http.HandleFunc("/new", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/new", func(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -90,6 +90,7 @@ func main() {
|
|||||||
fmt.Fprint(w, http.StatusText(200))
|
fmt.Fprint(w, http.StatusText(200))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fmt.Println("listening on :3000")
|
||||||
log.Fatal(http.ListenAndServe(":3000", nil))
|
log.Fatal(http.ListenAndServe(":3000", nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user