Which of the following resource names follows the best RESTful naming convention for a collection of user profiles?
Think about plural nouns and simplicity in RESTful URLs.
RESTful resource names should be plural nouns and simple. '/users' is the best choice because it clearly represents a collection of user resources.
What is the likely effect of using inconsistent resource naming like mixing singular and plural forms in API endpoints?
Consider the impact on developers using and maintaining the API.
Inconsistent naming does not cause runtime errors but makes the API confusing and harder to maintain.
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');
});Remember to use plural nouns and colon for parameters.
Using '/products/:id' follows RESTful conventions: plural resource name and parameter for ID.
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'); });Check singular vs plural usage in resource names.
Using singular '/user' for a collection is inconsistent with plural '/users/:id' for a single resource, which can confuse API users.
How can poor resource naming conventions affect the lifecycle and versioning of a Node.js REST API?
Think about how naming affects API stability and client expectations.
Poor naming can lead to breaking changes when fixing inconsistencies, making version upgrades harder and risking client breakage.