Errata

Jumpstarting JavaScript

Errata for Jumpstarting JavaScript

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
N/A
Make A Web Server

I get the error after at the node terminal after I enter localhost:8080 into Safari address bar

_http_server.js:208
throw new ERR_HTTP_INVALID_STATUS_CODE(originalStatusCode);
^

RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: I created this server!
at ServerResponse.writeHead (_http_server.js:208:11)
at Server.<anonymous> (/Users/ericsterling/JS Programming/easyserver.js:3:7)
at Server.emit (events.js:182:13)
at parserOnIncoming (_http_server.js:672:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)

Eric Sterling  Nov 28, 2018 
Printed Page 18
2nd paragraph

Navigating to
localhost:8080
as instructed produces something like the following stack dump:

node easyserver.js
_http_server.js:208
throw new ERR_HTTP_INVALID_STATUS_CODE(originalStatusCode);
^

RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: I created this server!
at ServerResponse.writeHead (_http_server.js:208:11)
at Server.<anonymous> (C:\Users\cgibbons\OneDrive\Documents\Study\easyserver.js:3:7)
at Server.emit (events.js:182:13)
at parserOnIncoming (_http_server.js:652:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)

C Gibbons  Nov 03, 2018 
Printed Page 18
3rd line of easyserver.js

As previously reported by C. Gibbons, line 3 of easyserver.js throws an ERR_HTTP_INVALID_STATUS_CODE error.

I believe changing line 3 from this:

res.writeHead('I created this server!');

to this:

res.write('I created this server!');

should successfully resolve the issue.

Thank you very much.

Andrew Mills  Dec 01, 2019