Skip to content

Commit

Permalink
rewrite-default-index-update (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel authored Nov 14, 2022
1 parent 466302a commit d257cf7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions scripts/mentorpal-rewrite-default-index-s3-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @param {*} event
* @returns
*/
function handler(event) {
function handler(event) {
var request = event.request;
var uri = request.uri;

Expand All @@ -22,14 +22,8 @@ function handler(event) {
return response;
}

if (uri == "/home" || uri == "/home/") {
request.uri = "/home/index.html";
}
if (uri == "/chat" || uri == "/chat/") {
request.uri = "/chat/index.html";
}
if (uri == "/admin" || uri == "/admin/") {
request.uri = "/admin/index.html";
if (!uri.includes(".")) {
request.uri = "/" + uri.split("/").filter(e=>e.length).join("/") +"/index.html";
}

return request;
Expand Down

0 comments on commit d257cf7

Please sign in to comment.