Comparing version 0.1.0 to 0.1.1
@@ -31,2 +31,10 @@ "use strict"; | ||
} | ||
function redirect(req, res, location) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
res.writeHead(302, 'Found', { | ||
'Location': location | ||
}); | ||
res.end(`Location: ${location}`); | ||
}); | ||
} | ||
function serveFile(req, res, extname, content) { | ||
@@ -143,2 +151,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
const expectedRequestPath = `/${path.relative(rootDir, requestedPath).replace(/\\/g, '/')}/`; | ||
if (pathname !== expectedRequestPath) { | ||
return redirect(req, res, expectedRequestPath); | ||
} | ||
const indexPath = path.normalize(path.join(requestedPath, 'index.html')); | ||
@@ -145,0 +157,0 @@ const indexContent = yield fsSafeRead(indexPath); |
{ | ||
"name": "yaserver", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Yet Another Server", | ||
@@ -5,0 +5,0 @@ "main": "out/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11725
229