feat: gpg and ssh keys
This commit is contained in:
parent
f08dfa02ab
commit
b9d7553420
6 changed files with 45 additions and 18 deletions
|
@ -5,8 +5,6 @@ import (
|
|||
"net/http"
|
||||
)
|
||||
|
||||
// TODO: html templates
|
||||
// TODO: download resume as PDF
|
||||
func main() {
|
||||
http.HandleFunc("/", Route)
|
||||
|
||||
|
|
20
src/route.go
20
src/route.go
|
@ -4,33 +4,21 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"slices"
|
||||
)
|
||||
|
||||
type URLParam struct{}
|
||||
|
||||
type W = http.ResponseWriter
|
||||
type R = *http.Request
|
||||
|
||||
var routes = []struct {
|
||||
methods []string
|
||||
regex *regexp.Regexp
|
||||
handler http.HandlerFunc
|
||||
}{
|
||||
{[]string{"GET"}, URL(""), func(w W, r R) {
|
||||
http.ServeFile(w, r, filepath.Join("html", "index.html"))
|
||||
}},
|
||||
{[]string{"GET"}, URL("/style\\.css"), func(w W, r R) {
|
||||
http.ServeFile(w, r, "/html/style.css")
|
||||
}},
|
||||
{[]string{"GET"}, URL("/static/.+"), func(w W, r R) {
|
||||
http.ServeFile(w, r, r.URL.Path)
|
||||
}},
|
||||
{[]string{"GET"}, URL("/[^/]+"), func(w W, r R) {
|
||||
http.ServeFile(w, r, filepath.Join("html", r.URL.Path + ".html"))
|
||||
}},
|
||||
{[]string{"GET"}, URL(""), Index},
|
||||
{[]string{"GET"}, URL("/style\\.css"), Style},
|
||||
{[]string{"GET"}, URL("/static/.+"), Static},
|
||||
{[]string{"GET"}, URL("/[^/]+"), HTML},
|
||||
}
|
||||
|
||||
func URL(s string) *regexp.Regexp {
|
||||
|
|
22
src/views.go
Normal file
22
src/views.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func Index(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, filepath.Join("html", "index.html"))
|
||||
}
|
||||
|
||||
func Style(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "/html/style.css")
|
||||
}
|
||||
|
||||
func Static(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, r.URL.Path)
|
||||
}
|
||||
|
||||
func HTML(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, filepath.Join("html", r.URL.Path + ".html"))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue