0
0
Node.jsframework~20 mins

Resource naming conventions in Node.js - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Resource Naming Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Choosing RESTful resource names

Which of the following resource names follows the best RESTful naming convention for a collection of user profiles?

A/users
B/getUsers
C/userProfiles
D/user_profile
Attempts:
2 left
💡 Hint

Think about plural nouns and simplicity in RESTful URLs.

component_behavior
intermediate
2:00remaining
Effect of inconsistent resource naming

What is the likely effect of using inconsistent resource naming like mixing singular and plural forms in API endpoints?

AIt causes runtime errors in Node.js applications
BIt automatically triggers validation errors
CIt improves API flexibility and clarity
DIt confuses API users and makes maintenance harder
Attempts:
2 left
💡 Hint

Consider the impact on developers using and maintaining the API.

📝 Syntax
advanced
2:00remaining
Correct resource naming in Express route

Which Express route correctly follows resource naming conventions for accessing a single product by ID?

const express = require('express');
const router = express.Router();

router.get( /* your code here */, (req, res) => {
  res.send('Product details');
});
A'/product/:id'
B'/products/:id'
C'/getProduct/:id'
D'/products/id'
Attempts:
2 left
💡 Hint

Remember to use plural nouns and colon for parameters.

🔧 Debug
advanced
2:00remaining
Identify naming issue causing confusion

Given these two Express routes, which naming issue can cause confusion or bugs?

router.get('/user', (req, res) => { res.send('All users'); });
router.get('/users/:id', (req, res) => { res.send('User details'); });
AUsing singular '/user' for all users is inconsistent with plural '/users/:id'
BRoutes are fine; no naming issues
CBoth routes use plural resource names correctly
DMissing colon in '/users/:id' causes parameter parsing error
Attempts:
2 left
💡 Hint

Check singular vs plural usage in resource names.

lifecycle
expert
3:00remaining
Impact of resource naming on API versioning and lifecycle

How can poor resource naming conventions affect the lifecycle and versioning of a Node.js REST API?

AIt automatically enables backward compatibility
BIt has no effect on API lifecycle or versioning
CIt forces breaking changes and complicates version upgrades
DIt simplifies adding new features without version changes
Attempts:
2 left
💡 Hint

Think about how naming affects API stability and client expectations.