ts build
This commit is contained in:
3
main.go
3
main.go
@@ -37,6 +37,7 @@ func NewTasks(db *sql.DB) (*Tasks, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.mux.HandleFunc("GET /{$}", t.serveRoot)
|
t.mux.HandleFunc("GET /{$}", t.serveRoot)
|
||||||
|
t.mux.Handle("GET /", http.FileServer(http.Dir("static")))
|
||||||
|
|
||||||
return t, nil
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ body {
|
|||||||
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/shoelace-autoloader.js"></script>
|
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/shoelace-autoloader.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
tasks!
|
<script type="module" src="main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
5
static/main.js
Normal file
5
static/main.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
function main() {
|
||||||
|
console.log("Hello, world!");
|
||||||
|
}
|
||||||
|
main();
|
||||||
5
ts/main.ts
Normal file
5
ts/main.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
function main() {
|
||||||
|
console.log("Hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"strict": true,
|
||||||
|
"outDir": "static"
|
||||||
|
},
|
||||||
|
"include": ["ts"],
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user