minimalistic-server 0.0.44 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/index.mjs +15 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
# node-minimalistic-server
|
|
2
|
-
Minimalistic server library for Node.js. It supports routing, middlewares, parsing common request bodies (JSON, form data, etc), static file serving.
|
|
2
|
+
Minimalistic server library for Node.js. It supports routing, middlewares, parsing common request bodies (JSON, form data, etc), static file serving.
|
|
3
|
+
In order to see how it works, you can download and run this [demo project](https://github.com/surenenfiajyan/files/raw/refs/heads/main/gallery.zip).
|
package/index.mjs
CHANGED
|
@@ -2084,11 +2084,21 @@ export function serve(routes, port = 80, staticFileDirectoryOrDirectories = null
|
|
|
2084
2084
|
}
|
|
2085
2085
|
|
|
2086
2086
|
export function escapeHtml(htmlStr) {
|
|
2087
|
-
return htmlStr?.toString()
|
|
2088
|
-
.replace(
|
|
2089
|
-
.replace(
|
|
2090
|
-
.replace(
|
|
2091
|
-
.replace(/
|
|
2087
|
+
return htmlStr?.toString()
|
|
2088
|
+
.replace(/&/gm, "&")
|
|
2089
|
+
.replace(/</gm, "<")
|
|
2090
|
+
.replace(/>/gm, ">")
|
|
2091
|
+
.replace(/"/gm, """)
|
|
2092
|
+
.replace(/'/gm, "'") ?? '';
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
export function unescapeHtml(htmlStr) {
|
|
2096
|
+
return htmlStr?.toString()
|
|
2097
|
+
.replace(/&/gm, "&")
|
|
2098
|
+
.replace(/</gm, "<")
|
|
2099
|
+
.replace(/>/gm, ">")
|
|
2100
|
+
.replace(/"/gm, '"')
|
|
2101
|
+
.replace(/'/gm, "'") ?? '';
|
|
2092
2102
|
}
|
|
2093
2103
|
|
|
2094
2104
|
export function unserve(port = 80) {
|