Skip to content

Commit 40cb5e6

Browse files
author
dev
committed
origin: move assets to public folder
1 parent d8ecfec commit 40cb5e6

File tree

7 files changed

+19
-7
lines changed

7 files changed

+19
-7
lines changed

origin/main.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"golang.org/x/crypto/acme/autocert"
2222
)
2323

24-
//go:embed assets/*
24+
//go:embed public/*
2525
var assetsFs embed.FS
2626

2727
const (
@@ -207,7 +207,7 @@ func loadRouter() (router chi.Router) {
207207
}
208208

209209
func IndexHandler(w http.ResponseWriter, req *http.Request) {
210-
file, _ := assetsFs.Open("assets/index.html")
210+
file, _ := assetsFs.Open("public/index.html")
211211
defer file.Close()
212212

213213
fileInfo, _ := file.Stat()
@@ -221,7 +221,7 @@ func IndexHandler(w http.ResponseWriter, req *http.Request) {
221221
}
222222

223223
func BinHandler(w http.ResponseWriter, req *http.Request) {
224-
file, _ := assetsFs.Open("assets/100k.bin")
224+
file, _ := assetsFs.Open("public/100k.bin")
225225
defer file.Close()
226226

227227
fileInfo, _ := file.Stat()
@@ -235,7 +235,7 @@ func BinHandler(w http.ResponseWriter, req *http.Request) {
235235
}
236236

237237
func CssHandler(w http.ResponseWriter, req *http.Request) {
238-
file, _ := assetsFs.Open("assets/100k.css")
238+
file, _ := assetsFs.Open("public/100k.css")
239239
defer file.Close()
240240

241241
fileInfo, _ := file.Stat()
@@ -249,7 +249,7 @@ func CssHandler(w http.ResponseWriter, req *http.Request) {
249249
}
250250

251251
func JpgHandler(w http.ResponseWriter, req *http.Request) {
252-
file, _ := assetsFs.Open("assets/100k.jpg")
252+
file, _ := assetsFs.Open("public/100k.jpg")
253253
defer file.Close()
254254

255255
fileInfo, _ := file.Stat()
@@ -263,7 +263,7 @@ func JpgHandler(w http.ResponseWriter, req *http.Request) {
263263
}
264264

265265
func JsHandler(w http.ResponseWriter, req *http.Request) {
266-
file, _ := assetsFs.Open("assets/100k.js")
266+
file, _ := assetsFs.Open("public/100k.js")
267267
defer file.Close()
268268

269269
fileInfo, _ := file.Stat()
@@ -277,7 +277,7 @@ func JsHandler(w http.ResponseWriter, req *http.Request) {
277277
}
278278

279279
func NotFoundHandler(w http.ResponseWriter, req *http.Request) {
280-
file, _ := assetsFs.Open("assets/404.html")
280+
file, _ := assetsFs.Open("public/404.html")
281281
defer file.Close()
282282

283283
fileInfo, _ := file.Stat()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

origin/assets/index.html origin/public/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55
<title>Hello World</title>
66
</head>
77
<body>
8+
89
<p>This is a static page (not cached)</p>
10+
<hr />
11+
12+
<p>The following domains are available to test the diggerent CDNs:</p>
13+
<ul>
14+
<li><a href="https://cloudflare.cloudflarebook.com">https://cloudflare.cloudflarebook.com</a></li>
15+
<li><a href="https://bunny-volume.cloudflarebook.com">https://bunny-volume.cloudflarebook.com</a></li>
16+
<li><a href="https://bunny.cloudflarebook.com">https://bunny.cloudflarebook.com</a></li>
17+
</ul>
18+
<hr />
19+
920
<p>Cached files:</p>
1021
<ul>
1122
<li><a href="/100k.bin">/100k.bin</a></li>
1223
<li><a href="/100k.css">/100k.css</a></li>
1324
<li><a href="/100k.jpg">/100k.jpg</a></li>
1425
<li><a href="/100k.js">/100k.js</a></li>
1526
</ul>
27+
1628
</body>
1729
</html>

0 commit comments

Comments
 (0)