Re: Time Tracker Challenge Question


I’m working on this project and after spending sometime learning more about express.js I noticed that the json object which is returned has html markup. Where does this come from? I though the response object would only show up in the developer console.

Hello @kbventures,

Your express-server does not return a json object but the file views/index.html. You will have to implement the “backend” logic in the app.js file, where it says:

app.get('/', (req, res) => { res.sendFile(__dirname + '/views/index.html'); });

The code you are quoting here is for the ‘/’ path.

My question is in regards to the /testing1 path.

Oh, did not understand from your first post that you’ve meant the /testing1 path, sry. The reason you get html is in the res.send() method. Use res.json() instead and it will work. Here is an article explaining the difference: res.send() vs. res.json(). Hope this helps. :wink:

Both res.send() and res.json() generate HTML

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.