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