TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation · 5.9K subscribers
Post #1195 490
✅ Backend Basics Interview Questions – Part 2 (Express.js Routing) 🚀🧠

📍 1. What is Routing in Express.js?
A:
Routing defines how your application responds to client requests (GET, POST, etc.) to specific endpoints (URLs).

📍 2. Basic Route Syntax
app.get('/home', (req, res) => {
  res.send('Welcome Home');
});

📍3. Route Methods 
- app.get() – Read data 
- app.post() – Create data 
- app.put() – Update data 
- app.delete() – Delete data 

📍 4. Route Parameters
app.get('/user/:id', (req, res) => {
  res.send(req.params.id);
});

📍 5. Query Parameters 
app.get('/search', (req, res) => {
  res.send(req.query.keyword);
});

📍 6. Route Chaining
app.route('/product')
  .get(getHandler)
  .post(postHandler)
  .put(putHandler);

📍 7. Router Middleware
const router = express.Router();
router.get('/about', (req, res) => res.send('About Page'));
app.use('/info', router);  // URL: /info/about

📍 8. Error Handling Route
app.use((req, res) => {
  res.status(404).send('Page Not Found');
});

💡 Pro Tip: Always place dynamic routes after static ones to avoid conflicts.

💬 Tap ❤️ if this helped you!
  • ❤ 1
More from @coding_interview_preparation
  1. Oct 10, 2026100 SQL interview questions
  2. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  3. Oct 6, 2026document post
  4. Oct 4, 2026💼 Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  5. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
  6. Oct 1, 2026Most Asked Topics in AI Engineer Interviews Based on 2026 candidate reports
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →