Caretaker Express · PostgreSQL · Cedar

Checkpoint · Lesson 1.2

Routes, requests and responses: checkpoint files

Git tag in the reference repository
lesson/m01-l02 (commit e753e00)
Replay result
All steps replayed from an empty folder
Tests at this point
no test suite yet

Compare your folder with the reference using Git, if you cloned it: git diff lesson/m01-l02 -- src.

Files changed in this lesson

package.json changed

package.json
{  "name": "caretaker",  "version": "1.0.0",  "description": "",  "scripts": {    "test": "echo \"Error: no test specified\" && exit 1",    "start": "node src/server.js",    "dev": "node --watch src/server.js"  },  "keywords": [],  "author": "",  "license": "ISC",  "type": "module",  "dependencies": {    "express": "5.3.0"  }}

src/server.js changed

src/server.js
import express from 'express'; const app = express();const port = 3000; const issues = [  { id: 1, title: 'Lift stuck between floors 2 and 3', priority: 'high', status: 'open', building: 'Dublin Offices', occurredAt: '2026-11-02T09:15:00.000Z' },  { id: 2, title: 'Dripping tap in the second-floor kitchen', priority: 'medium', status: 'closed', building: 'Dublin Offices', occurredAt: '2026-11-05T14:40:00.000Z' },  { id: 3, title: 'Front door lock sticks at entrance 4', priority: 'critical', status: 'open', building: 'Cork Apartments', occurredAt: '2026-11-08T07:05:00.000Z' },]; app.get('/', (req, res) => {  res.send('Caretaker is running');}); app.get('/api/issues', (req, res) => {  const { status } = req.query;  const result = status ? issues.filter((issue) => issue.status === status) : issues;  res.json(result);}); app.get('/api/issues/:id', (req, res) => {  const id = Number(req.params.id);  const issue = issues.find((e) => e.id === id);  if (!issue) {    return res.status(404).json({ error: 'Issue not found' });  }  res.json(issue);}); app.listen(port, () => {  console.log(`Caretaker listening on http://localhost:${port}`);});

Project tree at this checkpoint

.gitignore
.npmrc
package-lock.json
package.json
src/server.js

Back to lesson 1.2