Basic Node and Express -- Chain Middleware to Create a Time Server

Tell us what’s happening:
Describe your issue in detail here.

I have been having so much trouble using Replit to get through Basic Node and Express. I’ve tried using CodeSandbox but none of the URLs will pass. This is incredibly frustrating as my correctly written code will not pass due to odd/unpredictable problems that have slowed me to a snails pace.

Any help would be greatly appreciated. Thank you.

Your project link(s)

solution: https://replit.com/@blakelucey/boilerplate-express

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36.

Challenge: Chain Middleware to Create a Time Server

Link to the challenge:

Try res.json instead of res.send.

Unfortunately, this did not work. I am still experiencing the following errors:

// running tests
The /now endpoint should have mounted middleware
The /now endpoint should return a time that is +/- 20 secs from now
// tests completed

Date() is a constructor. You have to run it.

How do I need to change my code in order to run Date()?

Like you just did. You invoke a function by using parentheses in front of the identifier.

Look carefully:

new Date.toString()

Again Date is a function, it has to be invoked Date()

1 Like

Thank you for your help.

1 Like

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