lib/web-server.js
function createReadFilePromise () {
  return (filepath) => {
    return new Promise((resolve, reject) => {
      fs.readFile(filepath, 'utf8', function (error, data) {
        if (error) {
          reject(new Error(`Cannot read ${filepath}, got: ${error}`))
        } else if (!data) {
          reject(new Error(`No content at ${filepath}`))
        } else {
          resolve(data.split('\n'))
        }
      })
    })
  }
}
function createReadFilePromise () {
  return (filepath) => {
    return new Promise((resolve, reject) => {
      fs.readFile(filepath, 'utf8', function (error, data) {
        if (error) {
          reject(new Error(`Cannot read ${filepath}, got: ${error}`))
        } else if (!data) {
          reject(new Error(`No content at ${filepath}`))
        } else {
          resolve(data.split('\n'))
        }
      })
    })
  }
}
function createReadFilePromise ( ) { return ( filepath ) => { return new Promise ( ( resolve , reject ) => { fs . readFile ( filepath , 'utf8' , function ( error , data ) { if ( error ) { reject ( new Error ( ` ${ filepath } ${ error } ` ) ) } else if ( ! data ) { reject ( new Error ( ` ${ filepath } ` ) ) } else { resolve ( data . split ( '\n' ) ) } } ) } ) } }
Bind the filesystem into the injectable file reader function
Bind the filesystem into the injectable file reader function