Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:

I don’t know why my project is not passing the following tests 9-15:

These tests are all based on making a GET request to /api/users/:_id/logs which works on my end and returns the absolute same format as the test site provided by FCC. However, the test just gives me 404 Errors, even though I can access /api/users/:_id/logs just fine on different devices.

Here’s a screenshot of the result of one of the GET request:

Your project link(s)

My project is on Replit here: boilerplate-project-exercisetracker - Replit

I’d be very grateful for anyone’s help in the matter. Thank you!

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

Challenge Information:

Back End Development and APIs Projects - Exercise Tracker

You need to handle the optional data correctly. If no date payload is sent you have to use the current date and not send Invalid time format.

Not sure why that POST test isn’t failing but I think it should.

You can POST to /api/users/:_id/exercises with form data description, duration, and optionally date. If no date is supplied, the current date will be used.

Because you are sending that string the tests can’t do the GETs. Fixing the date response makes your project pass the tests for me.

Thank you for your reply! I’ve fixed the optional date issue (and for some reason it has always passed that relevant test too, but thank you for catching that) so that it doesn’t say ‘invalid time format’ anymore when the date field is left blank. However, the original issue still persists–these same problems are still not passed and I’m still getting 404s.

Oh! For some reason most of the tests are now passing after I removed the throw line :face_with_raised_eyebrow: But for some reason these two tests are still failing:

But the returned JSON is pretty much the same as the sample provided, so I don’t understand why this is happening.

The returned JSON in my project:

  "_id": "12",
  "username": "fcc_test_16999098929",
  "count": 2,
  "log": [
      "description": "test",
      "duration": 60,
      "date": "Mon Jan 01 1990"
      "description": "test",
      "duration": 60,
      "date": "Wed Jan 03 1990"

The sample provided:

  username: "fcc_test",
  count: 1,
  _id: "5fb5853f734231456ccb3b05",
  log: [{
    description: "test",
    duration: 60,
    date: "Mon Jan 01 1990",

I’ve even switched the username and id and count fields around (because the sample in the project page and what is actually returned in the test page are different) but to no avail… Also not sure why it thinks the date format is wrong when it’s literally a string and literally the same format as the sample!

Please ignore me–I’ve finally managed to get it to work by handling both '' and undefined for the date field! Thank you so so much for your help and patience!