Skip to content

Commit

Permalink
Some more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed Jul 25, 2016
1 parent 036400a commit e9ba58b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/list
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,21 @@ const server = micro(async (req, res) => {
res.setHeader('Content-Type', mime.lookup(indexPath) + '; charset=utf-8')

if (!await exists(indexPath)) {
// Try to render the current directory's content
const renderedDir = await renderDirectory(related)

// If it works, send the directory listing to the user
if (renderedDir) {
return send(res, 200, renderedDir)
}

// And if it doesn't, see if it's a single page application
// If that's not true either, send an error
if (!flags.single) {
return send(res, 404, 'Not found')
}

// But IF IT IS true, load the SPA's root index file
indexPath = path.join(current, '/index.html')
}

Expand Down

0 comments on commit e9ba58b

Please sign in to comment.