Skip to content

Sync finished code with modernized guide - #369

Merged
dipikabh merged 4 commits into
mdn:mainfrom
Josh-Cena:no-template
Nov 11, 2026
Merged

dipikabh merged 4 commits into
mdn:mainfrom
Josh-Cena:no-template

Conversation

@Josh-Cena

Copy link
Copy Markdown
Member

Accompanies mdn/content#45596

hamishwillee and others added 2 commits November 10, 2026 11:19
- Restore the "test" script so `npm test` works again.
- populatedb.js: log progress with console.log (as the guide describes),
  report failures with a non-zero exit code, and show a usage message
  with a local MongoDB URL example instead of Atlas credentials.
- Add demo.js and `npm run demo`, which runs the site against a
  temporary in-memory database filled with the sample data.
- README: describe the demo, the local MongoDB default (install, Docker
  or Atlas via MONGODB_URI), consistent start commands, the MDN-hosted
  data model diagram, and current MDN links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Format dates in UTC so they display as entered in every time zone
  (they were a day early west of UTC, and disagreed with the edit form).
- authorDeletePost deletes the author in the URL (req.params.id) rather
  than an id from the form body, so a forged request can't delete a
  different author who still has books. Remove the unused hidden field
  and add a regression test.
- bookUpdatePost redirects to book.url, so it doesn't crash if the book
  was deleted while the form was open.
- Restore the guide's lowercase "Delete author"/"Update author" and
  genre link text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hamishwillee added a commit to Josh-Cena/mdn-content that referenced this pull request Nov 10, 2026
Match the example code (mdn/express-locallibrary-tutorial#369):

- Format BookInstance dates in UTC, so they aren't shown a day early
  west of UTC, and remove the note about that limitation.
- Delete the author identified in the URL rather than an id from a
  hidden form field, and correct the explanation.
- Redirect to book.url after updating a book.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"1932-11-8" isn't a valid ISO date string, so it was parsed as local
midnight. With UTC date formatting, it displayed as Nov 7 on machines
east of UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hamishwillee hamishwillee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Josh-Cena

Merging this with the companion. I did some minor changes that came out of the review, including to the README.md to keep the instructions that allow easy testing (mostly by me).

@hamishwillee

Copy link
Copy Markdown
Collaborator

@dipikabh Can you please merge this and make me code-owner.

hamishwillee added a commit to mdn/content that referenced this pull request Nov 10, 2026
…45596)

* Yank Express Application Generator, migrate Express tutorial to ESM

* Make dev env set up the starter template

* Starter template creation instructions

* Update Mongoose

* Update routes

* Migrate Displaying_data

* Migrate forms

* Migrate deployment

* Express tutorial: fix dates, author delete id and book update redirect

Match the example code (mdn/express-locallibrary-tutorial#369):

- Format BookInstance dates in UTC, so they aren't shown a day early
  west of UTC, and remove the note about that limitation.
- Delete the author identified in the URL rather than an id from a
  hidden form field, and correct the explanation.
- Redirect to book.url after updating a book.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Express tutorial: review fixes

- Fix stale text left over from the generator and starter project
- Fix typo in Book detail page
- Update sample npm version and output, and the version prefix note
- Reword the PowerShell note
- Match the demo's viewport meta and Helmet comment
- Fix indentation of the Delete author snippet and explain it
- Fix date format in the BookInstance challenge
- Retake and compress the BookInstance list and Author detail screenshots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Express tutorial: fix inaccurate statements found in review

- Describe what server.js and routes/index.js actually do
- Clarify what the DEBUG variable turns on
- Correct the GraphQL description and match the ORM list form
- Drop the unsupported claim that CommonJS is legacy
- Use the due_back field name, not due_date
- Explain which dates are stored as midnight UTC

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Express tutorial: fix dead Express documentation links

The Express 5 API reference is now split into subpages, so the
expressjs.com/en/5x/api/#... anchors no longer work. Also fix the
express-router guide anchor and point the changelog link at the
GitHub releases page that it now redirects to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Express tutorial: fix outdated statements on unchanged lines

- Replace the Mongoose callback error-handling example, which no longer
  works in Mongoose 7+, with a Node readFile() callback example
- Say what express.urlencoded() and express.json() each parse
- Point the users route note at the running instructions, now later
- Remove "required" left over from CommonJS in the forms overview
- Explain the debug namespace in the deployment logging example
- Say that model modules export the model itself
- Link the MDN and Node ES modules pages in See also

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@dipikabh
dipikabh merged commit 52c8a3d into mdn:main Nov 11, 2026
1 check passed
@dipikabh

Copy link
Copy Markdown
Contributor

Hi @hamishwillee, you're already a code owner:

* @mdn/content-team @mdn/contractors

Since this PR also touched package files, it required approval from content-team as well, but I'm guessing you should be able to merge PRs that only touch the tutorial files.

@Josh-Cena
Josh-Cena deleted the no-template branch November 11, 2026 14:17
@hamishwillee

Copy link
Copy Markdown
Collaborator

Thanks for the clarification @dipikabh ! That restriction is a little annoying since updating the packages is the most common thing I'm likely to want to do!

@dipikabh

Copy link
Copy Markdown
Contributor

updating the packages is the most common thing I'm likely to want to do!

I see. I'll bring it up with the team to see if we can make an exception in this case

@hamishwillee

Copy link
Copy Markdown
Collaborator

Also ask for the Django example if you don't mind please @dipikabh - not the end of the world if I have to ask you guys every time.

@dipikabh

Copy link
Copy Markdown
Contributor

Hi @hamishwillee, we discussed this - we'll be leaving the ownership rules as they are for now.
We might revisit CODEOWNERS across repos next year, so we’ll keep this in mind then.

For now, you can continue to ping us if you’re blocked from merging a PR.

@hamishwillee

Copy link
Copy Markdown
Collaborator

Thanks for checking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants