Skip to content

Commit

Permalink
feat: add index support
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonnet committed Dec 4, 2020
1 parent 6e50df4 commit dc3625c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/exposeFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { COMPRESSIBLE_CONTENT_TYPES } from './COMPRESSIBLE_CONTENT_TYPES'

export function exposeFolder({
path: folderPath,
index,
cache = false,
maxAge = 1 * YEARS,
lastModified = true,
Expand All @@ -34,6 +35,9 @@ export function exposeFolder({
throw error
}
if (!stats.isFile()) {
if (index != null && stats.isDirectory()) {
return index(pathname, request)
}
return next(request)
}
const response = request.respond()
Expand Down

0 comments on commit dc3625c

Please sign in to comment.