Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/api/simple/folder/simple.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
simple text
22 changes: 13 additions & 9 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class Server {
this.clientOverlay = options.overlay;
this.clientLogLevel = options.clientLogLevel;

this.serveIndex = options.serveIndex;

this.publicHost = options.public;
this.allowedHosts = options.allowedHosts;
this.disableHostCheck = !!options.disableHostCheck;
Expand Down Expand Up @@ -470,15 +472,17 @@ class Server {
}
},
contentBaseIndex: () => {
if (Array.isArray(contentBase)) {
contentBase.forEach((item) => {
app.get('*', serveIndex(item));
});
} else if (
!/^(https?:)?\/\//.test(contentBase) &&
typeof contentBase !== 'number'
) {
app.get('*', serveIndex(contentBase));
if (this.serveIndex || typeof this.serveIndex === 'undefined') {
if (Array.isArray(contentBase)) {
contentBase.forEach((item) => {
app.get('*', serveIndex(item));
});
} else if (
!/^(https?:)?\/\//.test(contentBase) &&
typeof contentBase !== 'number'
) {
app.get('*', serveIndex(contentBase));
}
}
},
watchContentBase: () => {
Expand Down
3 changes: 3 additions & 0 deletions lib/options.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"type": "object",
"properties": {
"serveIndex": {
"type": "boolean"
},
"hot": {
"type": "boolean"
},
Expand Down