From bb83ef6079eef26fb82f8578564238297b7c0b91 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Mon, 17 Mar 2025 23:23:40 +0100 Subject: move --- webstats/scratch.lisp | 19 ++++++++++++++++++- webstats/server.lisp | 23 ++--------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/webstats/scratch.lisp b/webstats/scratch.lisp index b66310c..af68eb0 100644 --- a/webstats/scratch.lisp +++ b/webstats/scratch.lisp @@ -1,4 +1,3 @@ - (hunchentoot:define-easy-handler (vars-disp :uri "/vars") () (setf (hunchentoot:content-type*) "text/plain") (format nil "Hey ~{~A ~% ~}~%" @@ -30,3 +29,21 @@ :method "post" (:input :type "text" :name "title") (:input :type "submit" :value "submit" :name "submit")))))) + +;; (sqlite:with-open-database (db "test.db") +;; (drop-stats-table db) +;; (create-stats-table db)) + +;; (sqlite:with-open-database (db "test.db") +;; (sqlite:with-transaction db +;; (let ((ip "122.0.0.1") +;; (agent "sly")) +;; (add-ip db :ip ip) +;; (add-user-agent db :user-agent agent) +;; (insert db +;; :click nil +;; :page "ho" +;; :referer "ref" +;; :ip ip +;; :user-agent agent +;; :title "try")))) diff --git a/webstats/server.lisp b/webstats/server.lisp index 5df77b3..346dc11 100644 --- a/webstats/server.lisp +++ b/webstats/server.lisp @@ -18,30 +18,14 @@ (in-package :webstats) +(defvar *acceptor*) +(defvar *sqlite*) (yesql:import log-queries :from "queries.sql" :as :cl-yesql/sqlite :binding :all-functions) -;; (sqlite:with-open-database (db "test.db") -;; (drop-stats-table db) -;; (create-stats-table db)) - -;; (sqlite:with-open-database (db "test.db") -;; (sqlite:with-transaction db -;; (let ((ip "122.0.0.1") -;; (agent "sly")) -;; (add-ip db :ip ip) -;; (add-user-agent db :user-agent agent) -;; (insert db -;; :click nil -;; :page "ho" -;; :referer "ref" -;; :ip ip -;; :user-agent agent -;; :title "try")))) - (hunchentoot:define-easy-handler (visit :uri "/visit" :default-request-type :both) (title page referer click) @@ -93,9 +77,6 @@ (then #'response-to-json) (then #'plot))))))))))) -(defvar *acceptor*) -(defvar *sqlite*) - (defun start-server (port) (setf *acceptor* (make-instance 'hunchentoot:easy-acceptor :port port)) -- cgit v1.2.3