0
0
Node.jsframework~10 mins

Resource naming conventions in Node.js - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a REST API endpoint for users following naming conventions.

Node.js
app.get('/[1]', (req, res) => { res.send('User list'); });
Drag options to blanks, or click blank then click option'
Ausers
BuserList
CgetUsers
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form like 'user'
Including verbs like 'getUsers'
2fill in blank
medium

Complete the code to name a resource for blog posts correctly.

Node.js
const router = express.Router();
router.get('/[1]', (req, res) => { res.send('Posts'); });
Drag options to blanks, or click blank then click option'
Aposts
Bpost
CblogPost
DgetPosts
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'post'
Using camelCase like 'blogPost'
3fill in blank
hard

Fix the error in the resource naming for a product API endpoint.

Node.js
app.post('/[1]', (req, res) => { res.send('Create product'); });
Drag options to blanks, or click blank then click option'
AProduct
Bproducts
CcreateProduct
Dproduct
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'product'
Using verbs like 'createProduct'
4fill in blank
hard

Fill both blanks to correctly name a nested resource for comments on posts.

Node.js
app.get('/[1]/[2]', (req, res) => { res.send('Comments for post'); });
Drag options to blanks, or click blank then click option'
Aposts
Bcomments
Cpost
Dcomment
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular forms like 'post' or 'comment'
5fill in blank
hard

Fill all three blanks to correctly name a resource and its ID parameter in the URL.

Node.js
app.get('/[1]/:[2]/[3]', (req, res) => { res.send('Specific item detail'); });
Drag options to blanks, or click blank then click option'
Aproducts
BproductId
Creviews
DreviewId
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular resource names
Using generic or unclear ID names