π₯Week 7 Day 7 challenges
π§© Challenge 1: Modular Blog API
π Build a small blog API using Express Router.
Requirements:
Create routes folder
ποΈ posts.js
ποΈ authors.js
Each file should export a router
Main app.js must use them like:
Endpoints to include (just dummy responses):
β /posts/ β return list of posts
β /posts/:id β return a single post
β /authors/ β return list of authors
β /authors/:id β return author details
Add middleware:
Use morgan for request logging
Use uuid to generate post IDs
π§© Challenge 2: Notes API with Router + File Storage
π Build a simple Notes API, split into modules:
π /routes/notes.js
π /data/notes.json
Endpoints:
β GET /notes β return all notes
β POST /notes β add a new note
β DELETE /notes/:id β delete a note
Requirements:
βUse uuid to generate IDs
βUse fs to read/write JSON file
βUse express.json()` middleware
Extra:
Add CORS package so any frontend can access it
π§© Challenge 3: Student Manager
π Create Student Manager with:
π /routes/students.js
π /data/students.json
Endpoints:
β GET /students
β POST /students
β GET /students/:id
β DELETE /students/:id
Use packages:
dotenv β load PORT from .env
nodemon β auto restart
.env example:
π Optional Bonus
Add routes with Router-level middleware:
Example:
When you are done:
π₯share your solutions in the group,
π₯invite a friend,
and as always β
π₯stay well, stay curious, and stay coding βοΈ
π§© Challenge 1: Modular Blog API
π Build a small blog API using Express Router.
Requirements:
Create routes folder
ποΈ posts.js
ποΈ authors.js
Each file should export a router
Main app.js must use them like:
app.use("/posts", postsRouter); app.use("/authors", authorsRouter); Endpoints to include (just dummy responses):
β /posts/ β return list of posts
β /posts/:id β return a single post
β /authors/ β return list of authors
β /authors/:id β return author details
Add middleware:
Use morgan for request logging
Use uuid to generate post IDs
π§© Challenge 2: Notes API with Router + File Storage
π Build a simple Notes API, split into modules:
π /routes/notes.js
π /data/notes.json
Endpoints:
β GET /notes β return all notes
β POST /notes β add a new note
β DELETE /notes/:id β delete a note
Requirements:
βUse uuid to generate IDs
βUse fs to read/write JSON file
βUse express.json()` middleware
Extra:
Add CORS package so any frontend can access it
π§© Challenge 3: Student Manager
π Create Student Manager with:
π /routes/students.js
π /data/students.json
Endpoints:
β GET /students
β POST /students
β GET /students/:id
β DELETE /students/:id
Use packages:
dotenv β load PORT from .env
nodemon β auto restart
.env example:
PORT=4000 π Optional Bonus
Add routes with Router-level middleware:
Example:
router.use((req, res, next) => {
console.log("Students Router middleware running");
next(); });When you are done:
π₯share your solutions in the group,
π₯invite a friend,
and as always β
π₯stay well, stay curious, and stay coding βοΈ
Full Stack Camp pinned Β«π Welcome to Fullstack Summer Camp 2025! Learn. Build. Launch. Hey campers! π This is your one-stop space to master fullstack web development from scratch β right here on Telegram. Over the next 12 weeks, weβll dive deep into: π Frontend: HTML, CSS, JavaScriptβ¦Β»
Full Stack Camp pinned Β«Week 1 Day 1 π‘ What Is Coding? How It Works, Why It Matters, and How You Can Start π Welcome welcome welcome to Fullstack Summer Camp! α°ααααα π Today is Day 1 of our fullstack development journey. Whether you're here because you're curious, bored, orβ¦Β»
1οΈβ£ What is the main purpose of Express Router?
Anonymous Quiz
40%
a) To start the server
0%
b) To handle HTTP protocols
60%
c) To organize routes into modular files
0%
d) To replace middleware
2οΈβ£ Which line correctly creates a router instance?
Anonymous Quiz
40%
a) const router = express()
20%
b) const router = new Router()
40%
c) const router = express.Router()
0%
d) const router = require("router")
3οΈβ£ What does app.use("/users", usersRouter) do?
Anonymous Quiz
67%
a) Starts the users server
0%
b) Attaches middleware only for POST requests
33%
c) Prefixes all routes in usersRouter with /users
0%
d) Registers error middleware
4οΈβ£How do you read route parameters in Express?
Anonymous Quiz
0%
a) req.query
50%
b) req.params
50%
c) req.body
0%
d) req.route
5οΈβ£Which request URL matches this route? app.get("/products/:id")
Anonymous Quiz
67%
a) /products?id=5
33%
b) /products/5
0%
c) /product/5
0%
d) /products?id=:id
6οΈβ£What happens if you send two responses in one request?
Anonymous Quiz
0%
a) Express ignores the second one
50%
b) Server crashes
50%
c) Browser handles it
0%
d) Express throws an error
7οΈβ£Which package helps log HTTP requests?
Anonymous Quiz
100%
a) cors
0%
b) dotenv
0%
c) morgan
0%
d) uuid
8οΈβ£What problem does cors solve?
Anonymous Quiz
50%
a) Server crashes
0%
b) Cross-origin request blocking
50%
c) File uploads
0%
d) Route duplication
9οΈβ£Where should sensitive data like API keys be stored?
Anonymous Quiz
0%
a) In JavaScript files
0%
b) In package.json
100%
c) In .env file
0%
d) In routes
πHow do you set an HTTP status code in Express?
Anonymous Quiz
0%
a) res.send(404)
50%
b) res.status(404).send()
50%
c) req.status(404)
0%
d) res.code(404)
1οΈβ£1οΈβ£Which situation will cause an Express app to hang (never respond)?
Anonymous Quiz
33%
a) Sending res.json()
67%
b) Forgetting to call next() in middleware
0%
c) Using app.get()
0%
d) Forgetting express.json()
1οΈβ£2οΈβ£ What is a common mistake when using res.sendFile()?
Anonymous Quiz
0%
a) Sending JSON
100%
b) Forgetting absolute path or __dirname
0%
c) Using HTTP instead of HTTPS
0%
d) Missing headers
1οΈβ£3οΈβ£ What happens if two routes match the same request?
Anonymous Quiz
50%
a) Express throws an error
0%
b) Both routes run
50%
c) The first matching route runs
0%
d) The last route runs
1οΈβ£4οΈβ£ Which is TRUE about req.params and req.query?
Anonymous Quiz
0%
a) Both come from request body
0%
b) Both are optional URL data
50%
c) params come from route path, query from URL string
50%
d) They are identical
1οΈβ£5οΈβ£ What is the biggest downside of file-based storage (fs) APIs?
Anonymous Quiz
0%
a) Too secure
50%
b) Hard to read
50%
c) Not scalable & risk of data corruption
0%
d) Slow internet
1οΈβ£6οΈβ£ Why is fs.readFileSync() dangerous in servers?
Anonymous Quiz
0%
a) It uses callbacks
50%
b) It blocks the event loop
50%
c) It deletes files
0%
d) It crashes Express
1οΈβ£7οΈβ£ What best describes Express itself?
Anonymous Quiz
0%
a) A programming language
50%
b) A database
0%
c) A frontend library
50%
d) A Node.js web framework