docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a simple blog API that uses route parameters to handle requests for viewing blog posts and user profiles.
Your API should handle the following routes:
Get a specific blog post: GET /posts/:id
Get posts by category: GET /category/:categoryName/posts
Get a user profile: GET /users/:username
All route handlers should:
Create the following files:
app.js { .file }This file should:
app.listen())app.test.js { .file }This file should contain tests for the routes you created.
Web framework for Node.js.
Simple route middleware for Koa applications.
HTTP assertion library for testing.
Request:
GET /posts/42Expected Response:
{ "postId": "42" }Request:
GET /category/technology/postsExpected Response:
{ "category": "technology" }Request:
GET /users/aliceExpected Response:
{ "username": "alice" }