From e9ba58b3b453fa8d686dbbe33688a496b27b7b34 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Mon, 25 Jul 2016 13:27:30 +0200 Subject: [PATCH] Some more comments --- bin/list | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/list b/bin/list index cfb58dd2..e311abe8 100644 --- a/bin/list +++ b/bin/list @@ -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') }