• this is my code:

    function onPageRequest(req, res) { 
      var a = url.parse(req.url, true);
      if (a.pathname.substr(-1)=="/") { // a slash at the end, list the directory
        res.writeHead(200, {'Content-Type': 'text/html'});
        res.write("<html><body><p>Contents of "+a.pathname+"</p><ul>");
          res.write('<li><a href="'+a.pathname+f+'">'+f+'</a></li>');
    
        res.end("</ul></body></html>");
      } else { // No slash, try and open file
        f = E.openFile(a.pathname, "r");
        if (f !== undefined) { // File open succeeded - send it!
          res.writeHead(200, {'Content-Type': 'text/plain'});
          f.pipe(res); // streams the file to the HTTP response
        } else { // couldn't open file
          // first check if this was a directory             
          if (("E").readdir()!==undefined) { 
            // it was a directory - forward us to a page with the '/' on the end
            res.writeHead(301, {'Location': a.pathname+"/", 'Content-Type': 'text/plain'});  
            res.end("Moved");                                
          } else {                                              
            // else not found - send a 404 message
            res.writeHead(404, {'Content-Type': 'text/plain'});
            res.end("404: Page "+a.pathname+" not found");
          }
        }
      }
    }
    
    var wlan;
    var f;
    function onInit() {
      // Wire up up MOSI, MISO, SCK and CS pins (along with 3.3v and GND)
      SPI1.setup({mosi:D12, miso:D13, sck:D14});
      E.connectSDCard(SPI1, D4);
      // see what's on the device
      console.log(require("fs").readdirSync());
      var wifi = require("Wifi");
    
      wifi.connect("My_SSID", {password: "My_password"});
      require("http").createServer(onPageRequest).listen(80);
    }
    onInit();
    

    but the output i am getting from the terminal window:

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v86.113 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 1MB:512/512, manuf 0xe0 chip 0x4014
    >echo(0);
    ERROR: Unable to mount SD card : NOT_READY
    undefined
    =undefined
    > 
    
About