From 050d716a3cc8fa70d5bdab84d6188c68721c8dd1 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 21 Dec 2024 06:35:49 -0800 Subject: [PATCH] ts build --- main.go | 3 ++- static/index.html | 2 +- static/main.js | 5 +++++ ts/main.ts | 5 +++++ tsconfig.json | 9 +++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 static/main.js create mode 100644 ts/main.ts create mode 100644 tsconfig.json diff --git a/main.go b/main.go index 23aacc3..b6cbf15 100644 --- a/main.go +++ b/main.go @@ -37,6 +37,7 @@ func NewTasks(db *sql.DB) (*Tasks, error) { } t.mux.HandleFunc("GET /{$}", t.serveRoot) + t.mux.Handle("GET /", http.FileServer(http.Dir("static"))) return t, nil } @@ -92,7 +93,7 @@ func (t *Tasks) initRequest(w http.ResponseWriter, r *http.Request) error { } } - log.Printf("%s %s %s %s %s %#v", r.RemoteAddr, r.Method, r.Host, r.URL, r.Form) + log.Printf("%s %s %s %s %s", r.RemoteAddr, r.Method, r.Host, r.URL, r.Form) return nil } diff --git a/static/index.html b/static/index.html index d08c1ce..346c8d4 100644 --- a/static/index.html +++ b/static/index.html @@ -28,6 +28,6 @@ body { - tasks! + diff --git a/static/main.js b/static/main.js new file mode 100644 index 0000000..205c130 --- /dev/null +++ b/static/main.js @@ -0,0 +1,5 @@ +"use strict"; +function main() { + console.log("Hello, world!"); +} +main(); diff --git a/ts/main.ts b/ts/main.ts new file mode 100644 index 0000000..90d667d --- /dev/null +++ b/ts/main.ts @@ -0,0 +1,5 @@ +function main() { + console.log("Hello, world!"); +} + +main(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a96e462 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "strict": true, + "outDir": "static" + }, + "include": ["ts"], +} \ No newline at end of file