backend: lose the golang thing

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-09-15 10:03:00 -04:00
parent 65cd5b2f1e
commit 97829c969c
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
6 changed files with 91 additions and 85 deletions

View file

@ -1,11 +1,97 @@
# is-critter # is-critter
- https://htmx.org/docs/#installing [critters](https://www.merriam-webster.com/dictionary/critter) are hard to define.
It's a word that has unique meaning to everyone.
## links
- https://github.com/TA3/web-user-behaviour - https://github.com/TA3/web-user-behaviour
- https://www.merriam-webster.com/dictionary/critter - https://github.com/expressjs/morgan
|| critter name | y/n | time to decide | indecision | session_id ||
| | | | |
## database
```sqlite
sqlite> .schema button_clicks
CREATE TABLE button_clicks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT,
animal_name TEXT,
button_name TEXT,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
time_difference INTEGER -- Add this column for time difference
);
sqlite> select * from button_clicks;
1|8qlg1qktgdk5dzeq2vy7|Penguin|is critter|2023-09-15T13:36:44.934Z|1058
2|8qlg1qktgdk5dzeq2vy7|Spider|is not critter|2023-09-15T13:36:44.934Z|1454
3|8qlg1qktgdk5dzeq2vy7|Turtle|is not critter|2023-09-15T13:36:44.934Z|640
4|8qlg1qktgdk5dzeq2vy7|Squirrel|is not critter|2023-09-15T13:36:44.934Z|608
5|8qlg1qktgdk5dzeq2vy7|Wolf pup|is not critter|2023-09-15T13:36:44.934Z|546
6|8qlg1qktgdk5dzeq2vy7|Mouse|is critter|2023-09-15T13:36:44.934Z|1151
7|8qlg1qktgdk5dzeq2vy7|Raccoon|is critter|2023-09-15T13:36:44.934Z|360
8|8qlg1qktgdk5dzeq2vy7|Hummingbird|is critter|2023-09-15T13:36:44.934Z|592
9|8qlg1qktgdk5dzeq2vy7|Possum|is not critter|2023-09-15T13:36:44.934Z|418
10|8qlg1qktgdk5dzeq2vy7|Squirrel|is critter|2023-09-15T13:36:44.934Z|374
11|8qlg1qktgdk5dzeq2vy7|Newt|is critter|2023-09-15T13:36:44.934Z|367
12|8qlg1qktgdk5dzeq2vy7|Muskrat|is not critter|2023-09-15T13:36:44.934Z|424
13|8qlg1qktgdk5dzeq2vy7|Spider|is critter|2023-09-15T13:36:44.934Z|338
14|8qlg1qktgdk5dzeq2vy7|Fox|is critter|2023-09-15T13:36:44.934Z|250
15|8qlg1qktgdk5dzeq2vy7|Frog|is not critter|2023-09-15T13:36:44.934Z|652
16|8qlg1qktgdk5dzeq2vy7|Fox|is critter|2023-09-15T13:36:44.934Z|395
17|8qlg1qktgdk5dzeq2vy7|Armadillo|is not critter|2023-09-15T13:36:44.934Z|352
18|8qlg1qktgdk5dzeq2vy7|Penguin|is not critter|2023-09-15T13:36:44.934Z|241
19|8qlg1qktgdk5dzeq2vy7|Spider|is not critter|2023-09-15T13:36:44.934Z|230
20|8qlg1qktgdk5dzeq2vy7|Fox|is not critter|2023-09-15T13:54:37.059Z|954
21|8qlg1qktgdk5dzeq2vy7|Muskrat|is critter|2023-09-15T13:54:37.059Z|1439
22|8qlg1qktgdk5dzeq2vy7|Hummingbird|is not critter|2023-09-15T13:54:37.059Z|864
23|8qlg1qktgdk5dzeq2vy7|Frog|is critter|2023-09-15T13:54:37.059Z|926
24|8qlg1qktgdk5dzeq2vy7|Raccoon|is critter|2023-09-15T13:54:37.059Z|608
25|8qlg1qktgdk5dzeq2vy7|Parakeet|is not critter|2023-09-15T13:54:37.059Z|657
26|8qlg1qktgdk5dzeq2vy7|Otter|is critter|2023-09-15T13:58:55.527Z|222
27|8qlg1qktgdk5dzeq2vy7|Frog|is critter|2023-09-15T13:58:55.527Z|232
28|8qlg1qktgdk5dzeq2vy7|Iguana|is not critter|2023-09-15T13:58:55.527Z|363
29|8qlg1qktgdk5dzeq2vy7|Rat|is not critter|2023-09-15T13:58:55.527Z|607
30|8qlg1qktgdk5dzeq2vy7|Penguin|is critter|2023-09-15T13:58:55.527Z|296
31|8qlg1qktgdk5dzeq2vy7|Eagle|is critter|2023-09-15T13:58:55.527Z|327
32|8qlg1qktgdk5dzeq2vy7|Hummingbird|is not critter|2023-09-15T13:58:55.527Z|349
33|8qlg1qktgdk5dzeq2vy7|Otter|is not critter|2023-09-15T13:58:55.527Z|234
34|8qlg1qktgdk5dzeq2vy7|Mouse|is critter|2023-09-15T13:58:55.527Z|529
35|fcfmr5poqjm7d1hfjxlkn|Frog|is critter|2023-09-15T13:58:59.925Z|1649
36|fcfmr5poqjm7d1hfjxlkn|Squirrel|is critter|2023-09-15T13:58:59.925Z|584
37|fcfmr5poqjm7d1hfjxlkn|Possum|is not critter|2023-09-15T13:58:59.925Z|384
38|fcfmr5poqjm7d1hfjxlkn|Frog|is not critter|2023-09-15T13:58:59.925Z|287
39|fcfmr5poqjm7d1hfjxlkn|Wolf pup|is not critter|2023-09-15T13:58:59.925Z|465
40|fcfmr5poqjm7d1hfjxlkn|Snake|is critter|2023-09-15T13:58:59.925Z|520
41|liaphs16jxpx2tnui258zn|Turtle|is critter|2023-09-15T13:59:03.509Z|871
42|liaphs16jxpx2tnui258zn|Iguana|is not critter|2023-09-15T13:59:03.509Z|377
43|liaphs16jxpx2tnui258zn|Armadillo|is not critter|2023-09-15T13:59:03.509Z|192
44|liaphs16jxpx2tnui258zn|Beaver|is not critter|2023-09-15T13:59:03.509Z|176
45|liaphs16jxpx2tnui258zn|Pigeon|is not critter|2023-09-15T13:59:03.509Z|222
46|liaphs16jxpx2tnui258zn|Possum|is not critter|2023-09-15T13:59:03.509Z|413
47|n7j7w370ysbirrkjma1f1|Spider|is critter|2023-09-15T13:59:05.892Z|910
48|n7j7w370ysbirrkjma1f1|Mouse|is critter|2023-09-15T13:59:05.892Z|182
49|n7j7w370ysbirrkjma1f1|Parakeet|is critter|2023-09-15T13:59:05.892Z|179
50|n7j7w370ysbirrkjma1f1|Rat|is not critter|2023-09-15T13:59:05.892Z|272
51|n7j7w370ysbirrkjma1f1|Muskrat|is not critter|2023-09-15T13:59:05.892Z|289
52|n7j7w370ysbirrkjma1f1|Spider|is critter|2023-09-15T13:59:05.892Z|308
53|n7j7w370ysbirrkjma1f1|Penguin|is critter|2023-09-15T13:59:05.892Z|217
54|n7j7w370ysbirrkjma1f1|Hamster|is critter|2023-09-15T13:59:05.892Z|176
55|5l4al5v3fcb8n0wyjfp28|Squirrel|is not critter|2023-09-15T13:59:08.261Z|866
56|5l4al5v3fcb8n0wyjfp28|Beaver|is not critter|2023-09-15T13:59:08.261Z|216
57|5l4al5v3fcb8n0wyjfp28|Hummingbird|is not critter|2023-09-15T13:59:08.261Z|135
58|5l4al5v3fcb8n0wyjfp28|Mouse|is critter|2023-09-15T13:59:08.261Z|648
59|5l4al5v3fcb8n0wyjfp28|Mouse|is critter|2023-09-15T13:59:08.261Z|182
60|5l4al5v3fcb8n0wyjfp28|Parakeet|is critter|2023-09-15T13:59:08.261Z|186
61|427cbcn3r8ivblc8ey3alf|Cricket|is critter|2023-09-15T13:59:10.480Z|785
62|427cbcn3r8ivblc8ey3alf|Otter|is critter|2023-09-15T13:59:10.480Z|185
63|427cbcn3r8ivblc8ey3alf|Parakeet|is critter|2023-09-15T13:59:10.480Z|150
64|427cbcn3r8ivblc8ey3alf|Snake|is not critter|2023-09-15T13:59:10.480Z|297
65|427cbcn3r8ivblc8ey3alf|Otter|is not critter|2023-09-15T13:59:10.480Z|176
66|427cbcn3r8ivblc8ey3alf|Mouse|is not critter|2023-09-15T13:59:10.480Z|184
67|427cbcn3r8ivblc8ey3alf|Frog|is critter|2023-09-15T13:59:10.480Z|288
68|427cbcn3r8ivblc8ey3alf|Pigeon|is critter|2023-09-15T13:59:10.480Z|214
69|427cbcn3r8ivblc8ey3alf|Rabbit|is critter|2023-09-15T13:59:10.480Z|954
70|427cbcn3r8ivblc8ey3alf|Spider|is not critter|2023-09-15T13:59:10.480Z|464
```

View file

@ -1,10 +0,0 @@
module git.batts.cloud/vbatts/critter/backend
go 1.20
require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/redis/go-redis/v9 v9.1.0 // indirect
)

View file

@ -1,8 +0,0 @@
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/redis/go-redis/v9 v9.1.0 h1:137FnGdk+EQdCbye1FW+qOEcY5S+SpY9T0NiuqvtfMY=
github.com/redis/go-redis/v9 v9.1.0/go.mod h1:urWj3He21Dj5k4TK1y59xH8Uj6ATueP8AH1cY3lZl4c=

View file

@ -1,30 +0,0 @@
package main
import (
"net/http"
"text/template"
"github.com/gorilla/mux"
"github.com/redis/go-redis/v9"
)
var (
client *redis.Client
templates *template.Template
)
func main() {
client = redis.NewClient(&redis.Options{
Addr: "localhost:6379",
DB: 0,
})
templates = template.Must(template.ParseGlob("templates/*.html"))
r := mux.NewRouter()
r.HandleFunc("/", indexHandler).Methods("GET")
http.Handle("/", r)
http.ListenAndServe(":8080", nil)
}
func indexHandler(w http.ResponseWriter, r *http.Request) {
templates.ExecuteTemplate(w, "index.html", nil)
}

View file

@ -1 +0,0 @@

View file

@ -1,31 +0,0 @@
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/TA3/web-user-behaviour/userBehaviour.min.js"></script>
<script src="https://unpkg.com/htmx.org@1.9.5" integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" crossorigin="anonymous"></script>
<script>
userBehaviour.config( {
userInfo: true,
clicks: true,
mouseMovement: true,
mouseMovementInterval: 1,
mouseScroll: true,
timeCount: true,
clearAfterProcess: true,
processTime: 15,
processData: function(results){
console.log(results);
},
});
userBehaviour.start();
</script>
</head>
<body>
booger snatch
<button hx-post="/clicked" hx-trigger="click" hx-target="#parent-div" hx-swap="outerHTML" >is critter</button>
<button hx-post="/clicked" hx-trigger="click" hx-target="#parent-div" hx-swap="outerHTML" >is not critter</button>
</body>
</html>