Basic Node and Express - Meet the Node console

Tell us what’s happening:
Describe your issue in detail here.
the replit starter pacage is not working.
Your code so far

Your browser information:

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

Challenge: Basic Node and Express - Meet the Node console

Link to the challenge:

You were not asked to add app.listen()

That code is handled for you inside server.js (which you should not touch).


The code is not yet serving anything which is expected. You will change that in the coming lessons.

I just trying to solve it. that why i added the app.listen. it doesnt work with or without the app.listen

it works now because i removed the last line of code which is (module.exports = app;).
so i guess that should be removed from the repository code

Not true.

The app.listen() code is inside server.js and that is how the tests are run.

You should not remove the export as that is how the tests use your code inside myApp.js

You should not add app.listen() to myApp.js


All you had to do to pass the console test was to remove app.listen() from myApp.js and keep everything else as it was.

Thanks. it was a little bug from replit. i just found out that i have to stop and run each time i make changes.

Yes.

It should also restart if you save using the keyboard Ctrl + S but I don’t always trust it so I often just restart the server anyway.

You can also add --watch to the npm script start script. But I can’t guarantee it to work either.

  "scripts": {
    "start": "node --watch server.js"
  }

Tell us what’s happening:
Describe your issue in detail here.
I’m stuck . the /json display correctly.
Your project link(s)

Your browser information:

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

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

thanks. but I’m stucked again.
here is the code.

Read the requirements again.

access process.env.MESSAGE_STYLE and transform the response object’s message to uppercase if the variable equals uppercase .

Your code

if (process.env.MESSAGE_STYLE==="allCaps") {

You can use the @ in front of people’s names to get their attention, like so @quitelook

i used uppercase too. it didnt work. thats why im trying (allcaps)

I have merged your threads.


That doesn’t really help me. Please correct the code and try again. Then I can see your current code as is. In any case, allCaps is not what is asked for so I’m not sure what trying it would do.


Edit: Your code is outside the GET route handler. It needs to be inside the handler.

I have correct the code,

i did that earlier. i have corrected the code now Still not working

The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"} , depending on the MESSAGE_STYLE value.

but it works in the url/json

okay i will try this method now. and change the hello world back to hello json

i have tried everything still not working. can you check through the code for me?

The string has to match exactly what is asked for. Check it again (the letter cases should match).


Edit: looks like you got it your Replit is passing the tests for me now.

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