const
   URL      = require( 'url'     ),
   FS       = require( 'fs'      ),
   MIME     = require( '../mime' ),

   PUBLIC   = process.env.npm_package_config_public,
   INDEX    = process.env.npm_package_config_index,

   OK       = 200,
   NOTFOUND = 404;

module.exports = function( req, res ) {
   let
      page = URL.parse( req.url ).pathname,
      file = ( page === '/' ) ? INDEX : page;
      
   FS.access( PUBLIC + file, FS.constants.R_OK, ( error ) => {
      if ( !error ) {
         stream = FS.createReadStream( PUBLIC + file ),
         type   = MIME.lookup( PUBLIC + file );
         FS.stat( PUBLIC + file, ( error, stats ) => {
            if ( !error ) {
               res.writeHead( OK, {
                  'Content-Length': stats.size,
                  'Content-Type': type
               });
               stream.pipe( res );
               console.log( `File "${ file } (length: ${ stats.size } B)" successfully served.` );
            } else {
               res.statusCode = NOTFOUND;
               res.end();
               console.log( `File "${ file }" not found, status "${ NOTFOUND }" served.` );
            };
         });
      } else {
         res.statusCode = NOTFOUND;
         res.end();
         console.log( `File "${ file }" not found, status "${ NOTFOUND }" served.` );
      };
   });
};
@@ -259,16 +259,142 @@
 ND = 404
+,%0D%0A      %0D%0A   SUCC     = 'File %25s (length: %25d B)%22 successfully served.',%0D%0A   FAIL     = 'File %25s not found, status %25d served.'
 ;%0D%0A%0D%0Amod
@@ -528,16 +528,45 @@
 X : page
+,%0D%0A      path = PUBLIC + file
 ;%0D%0A     
@@ -582,29 +582,20 @@
 access( 
-PUBLIC + file
+path
 , FS.con
@@ -685,29 +685,20 @@
 Stream( 
-PUBLIC + file
+path
  ),%0D%0A   
@@ -725,29 +725,20 @@
 lookup( 
-PUBLIC + file
+path
  );%0D%0A   
@@ -752,29 +752,20 @@
 S.stat( 
-PUBLIC + file
+path
 , ( erro
@@ -1024,75 +1024,30 @@
 og( 
-%60File %22$%7B file %7D (length: $%7B stats.size %7D B)%22 successfully served.%60
+SUCC, file, stats.size
  );%0D
@@ -1171,68 +1171,28 @@
 og( 
-%60File %22$%7B file %7D%22 not found, status %22$%7B NOTFOUND %7D%22 served.%60
+FAIL, file, NOTFOUND
  );%0D
@@ -1322,68 +1322,28 @@
 og( 
-%60File %22$%7B file %7D%22 not found, status %22$%7B NOTFOUND %7D%22 served.%60
+FAIL, file, NOTFOUND
  );%0D
@@ -1363,8 +1363,10 @@
  %7D);%0D%0A%7D;
+%0D%0A

Update index.js