The Scoop - issue with node server.js

When I first try to start the project with the sample code by calling node server.js. The terminal says listening on port 4000. Yet, I don’t seem to be connecting on localhost:4000/index.html when I call in the browser. However, if I use this simple code for a node server.js I see “Hello World” in the web browser.

var http = require(‘http’);

function onRequest(request, response) {
response.writeHead(200, {‘Content-Type’: ‘text/plain’});
response.write(“Hello World”);


Might there be a problem with the sample code provided?

This whole project is a complete mess. Zero preparation for this type of project. Just has us copying existing code, only for it to be a huge waste of time. Even the “solution” doesn’t run in the browser properly. If the purpose of this project was for us to spend a ton of time trying to figure out why the server won’t even display the index (because no routes for index, , let alone do anything else, then mission accomplished. You all seriously need to look at this one.
@factoradic @mtf

@kanenwis @systemsurfer51891 I decided to give it a go. I download the project, executed commands that were provided in the file and it works fine.

Exactly, route for index is not defined. There is no need to serve index.html through the API. Quote from the file:

To view your local version of the site, open index.html in Google Chrome.

Just double click the file, it will open index.html in your browser, that’s all.

To check if the API works correctly open localhost:4000/articles.