Help with the http uppercaserer challenge

Help with the http uppercaserer challenge


Hello all,

I have been working on this code and I cannot figure out what is going on. My code is as follows:

var http = require(‘http’);
var fs = require(‘fs’);
var map = require(‘through2-map’);

var port = process.argv[2];
var fileLocation = process.argv[3];
var srcStream = fs.createReadStream(fileLocation);

var server = http.createServer(function callback (req, res) {
srcStream.pipe(map(function(stream) {
return stream.toString().toUpperCase();



when I run the program using node httpServer.js 8080 “./test/test.txt” my code is able to read the text file, upper-case the text and display it on the screen in all caps. when I run learnyounode verify httpServer.js I get this error:


TypeError: path must be a string
at TypeError (native)
at (fs.js:540:11)
at (fs.js:1673:6)
at new ReadStream (fs.js:1660:10)
at Object.fs.createReadStream (fs.js:1608:10)
at Object. (/home/ubuntu/workspace/httpServer.js:7:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)

Your submission results compared to the expected:

✗ Error connecting to http://localhost:6753:

✗ Submission results did not match expected!

Why am I not able to pass this challenge? Are the arguments being passed to my function the wrong type or is this a bug with the cloud9 service not being able to connect in the way learnyounode expects? thanks in advance!!


Try adding console.log(fileLocation) just before the server gets created, and execute learnyounode run httpServer.js to test it.


Ok I was able to get my code working. I switched back to chrome from firefox and that seemed to help. My code is a little different from the solution displayed at the end but I got it working like this:

var http = require(‘http’);
var port = process.argv[2];

var server = http.createServer(function(req, res) {
var body = [];
var bodyString;

req.on('data', function(data) {

req.on('end', function(){
    bodyString = body.join("").toUpperCase();



the example code used the through2-map library to convert everything and pipe it directly to the response. I think that method is faster than mine but they both work just the same. Thank you for the help!