Browse Source

Add support for serving static files

Frans Bergman 4 năm trước cách đây
mục cha
commit
b2cabaab1b
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      bin/wesh.sh

+ 8 - 4
bin/wesh.sh

@@ -7,8 +7,12 @@ cd ..
 
 [ -f "$SITE_DIR/_wesh/config" ] && . "$SITE_DIR/_wesh/config"
 
-printf "Content-Type: text/html\n"
-printf "\n"
+if [ -f "./$REQUEST_PATH" ]; then
+    static_file "./$REQUEST_PATH"
+else
+    printf "Content-Type: text/html\n"
+    printf "\n"
 
-handler lib/headers.tpl
-handler lib/default_master.tpl
+    handler lib/headers.tpl
+    handler lib/default_master.tpl
+fi