Nobody has started this yet — be first.
Business impact
POST /auth/login returns a user object at login time, but that's the only moment a client ever sees its own profile. If the token is loaded from storage later (page refresh, a different tab, a mobile app resuming from background) there is no endpoint to ask "who am I, according to this token?" without re-deriving it client-side from the JWT payload -- exactly the kind of trust-the-client shortcut this codebase's ownership model is built to avoid everywhere else.
Problem
A route has already been wired up -- GET /auth/me in src/routes/auth.js, behind requireAuth -- but its handler is only a stub that unconditionally throws Error('GET /auth/me is not implemented yet'), which the centralized error handler turns into a 500.
Current behavior
GET /auth/me with a valid token returns 500 Internal Server Error instead of the caller's own profile.
Expected behavior
GET /auth/me, given a valid Authorization: Bearer <token>, returns { "user": { "id", "email", "createdAt" } } for the account the token belongs to -- the same shape serializeUser already produces for /auth/register and /auth/login. With no token (or an invalid one), it 401s exactly like every other authenticated route already does.
Steps to reproduce
cd nodejs/blog_api
node_modules/.bin/jest --config practice-tickets/jest.config.js
practice-tickets/tests/ticket03_get_auth_me_missing.test.js --verbose
Why this matters
requireAuth only decodes the JWT payload ({ sub, email }) into req.user -- it never re-reads the database, so a token's claims could in principle be stale and, more importantly, nothing anywhere currently proves the account still exists / fetches its createdAt. This is a one-route, one-query feature, but it's the first time a route needs to look up "the caller's own record" rather than someone else's, which is a slightly different shape than the ownership lookups already in this file.
Suggested approach
Replace the stub body of GET /me in src/routes/auth.js. Look at how src/middleware/ownership.js's loadPost/loadComment do a plain prisma.<model>.findUnique({ where: { id } }), and how serializeUser from src/lib/serialize.js is already used by /register and /login -- this route needs the same two pieces, just keyed on req.user.id instead of a route param.
Acceptance criteria
Verification
node_modules/.bin/jest --config practice-tickets/jest.config.js practice-tickets/tests/ticket03_get_auth_me_missing.test.js --verbose
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
$git checkout -b feat/get-auth-me-missingFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/get-auth-me-missingSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign indocker compose down -vTo run locally without Docker, you need a local PostgreSQL instance:
npm install
cp .env.example .env # edit DATABASE_URL, JWT_SECRET, etc.
npm run prisma:migrate:dev # applies migrations to your local Postgres
npm run dev # starts with --watch on http://localhost:3000
Run the project's own test suite (real Postgres, not mocks -- point DATABASE_URL at a disposable database first):
npm test
Work the tickets in practice-tickets/ (ticket01 through ticket07); each has its own dedicated Jest test under practice-tickets/tests/, run via a separate Jest config (practice-tickets/jest.config.js) so plain npm test never picks them up:
docker compose up -d postgres # if it isn't already running
npm run prisma:migrate
./practice-tickets/run_tickets.sh # all 7, clean pass/fail summary
node_modules/.bin/jest --config practice-tickets/jest.config.js \
practice-tickets/tests/ticket01_pagination_skip_off_by_one.test.js --verbose # a single ticket
Level 2
Implement a feature
Extend the system within its own patterns.