Skip to content

Commit 57f1c8b

Browse files
authored
docs: document the API reference style conventions
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
1 parent 64847d8 commit 57f1c8b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/content.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ src/content/api/
134134
- Versioned: `/en/5x/api/application` → Express 5.x application API
135135
- Non-versioned: `/en/api/application` → Defaults to Express 5.x
136136

137+
### Style Conventions
138+
139+
The reference pages for every version follow the same conventions, so that switching between
140+
Express 4.x and 5.x only shows real API differences:
141+
142+
- Property and method sections are listed alphabetically, so `req.host` comes before `req.hostname`.
143+
- Result comments in code samples use single quotes, matching the Prettier `singleQuote` setting:
144+
`res.type('png'); // => 'image/png'`. Double quotes are kept only where the sample shows JSON or a
145+
raw HTTP header.
146+
- The frontmatter `description` of the request and response pages repeats the opening sentence of the
147+
page, which refers to the objects as `req` and `res` rather than spelling out their full names.
148+
149+
`tests/unit/api-docs-style.test.mjs` checks these conventions, and it runs as part of `npm run test:unit`.
150+
137151
## Versioning
138152

139153
The Express.js documentation supports multiple versions. Content is organized by version in both the `docs` and `api` collections.

0 commit comments

Comments
 (0)