spa-ssi 0.0.3 → 0.0.4
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/package.json +1 -1
- package/serve.js +3 -2
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -76,7 +76,7 @@ class SimpleHTTPRequestHandler {
|
|
|
76
76
|
|
|
77
77
|
} catch (err) {
|
|
78
78
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
79
|
-
res.end(
|
|
79
|
+
res.end(`404 Not Found: ${JSON.stringify(err, null, 2)} \n`);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -191,7 +191,8 @@ class SimpleHTTPRequestHandler {
|
|
|
191
191
|
const tasks = [];
|
|
192
192
|
let match;
|
|
193
193
|
while ((match = includeRegex.exec(html)) !== null) {
|
|
194
|
-
const
|
|
194
|
+
const includeString = match[1];
|
|
195
|
+
const includePath = includeString.startsWith('/') ? path.join(process.cwd(), includeString) : path.join(currentDir, includeString);
|
|
195
196
|
const content = await fs.readFile(includePath, 'utf8');
|
|
196
197
|
html = html.replace(match[0], content);
|
|
197
198
|
|