C. express should be imported with import, not require
D. app.listen requires a port number as a string
Solution
Step 1: Check app instance creation
The code assigns app = express without calling it. It should be express() to create the app instance.
Step 2: Verify app.listen usage
Calling app.listen(3000) is correct; port number is a number, and callback is optional.
Final Answer:
Missing parentheses when creating app instance -> Option B
Quick Check:
express() must be called to create app [OK]
Hint: Remember to call express() with parentheses [OK]
Common Mistakes:
Assigning app = express instead of app = express()
Passing port as string instead of number (allowed but not required)
Thinking callback in listen is mandatory
5. You want to create an Express server that listens on port 8080 and responds with 'Welcome!' at the root URL. Which code snippet correctly does this?