Skip to content

Commit

Permalink
Ensures root loads index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
aleph-naught2tog committed Jan 5, 2019
1 parent 2d7e636 commit fc58c65
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion server/index.doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ const getPath = request => {
if (isModuleRequest(request)) {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}.js`;
} else {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}`;
// This ensures that navigating to "localhost:PORT" just loades the homepage
if (parsedUrl.pathname === '/') {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}index.html`;
} else {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}`;
}
}
};

Expand Down
6 changes: 5 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const getPath = request => {
if (isModuleRequest(request)) {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}.js`;
} else {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}`;
if (parsedUrl.pathname === '/') {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}index.html`;
} else {
return `${SERVER_ROOT_FOLDER}${parsedUrl.pathname}`;
}
}
};

Expand Down

0 comments on commit fc58c65

Please sign in to comment.