🚀 Feature Proposal
I'd suggest three minor things to enhance the docs:
- unify the way of importing and initializing the app throughout the docs so that they're the same across the whole docs
- as discussed with Matteo, it might make sense to rename references to
fastify/server to app throughout the docs.
- for the basic examples, I'd suggest to keep all the examples with the same configuration (which is to enable the logger)
- name name the parameters in the docs consistently (sometimes it's
req and sometimes it's request)
Motivation
Currently, there are different examples on how Fastify is being imported and how the app is being initialized (see below). Also, with the rise of ESM-Modules, imports mostly shift from something like const Fastify = require('fastify') to import Fastify from 'fastify', which makes things, such as const app = require('fastify')({ logger: true }) impossible. Also, it's less of a mind-shifting to use the same terms for the same thing (using the term app instead of using fastify or server for actually the same thing)
Currently, these are the two variations:
JavaScript (shortened):
const fastify = require('fastify')({
logger: true
})
TypeScript (shortened):
import Fastify from 'fastify'
const server = Fastify({})
Example
With this proposal, the above examples and all examples throughout the documentation would be unified in terms of how to name and initialize the app. Also, the example of directly importing and initializing the app in one step will be split up into an import and a separate initialization. This avoids varying terms like fastify and server for actually the same thing.
JavaScript (shortened):
const Fastify = require('fastify')
const app = Fastify({ logger: true })
TypeScript (shortened):
import Fastify from 'fastify'
const app = Fastify({ logger: true })
🚀 Feature Proposal
I'd suggest three minor things to enhance the docs:
fastify/servertoappthroughout the docs.reqand sometimes it'srequest)Motivation
Currently, there are different examples on how Fastify is being imported and how the app is being initialized (see below). Also, with the rise of ESM-Modules, imports mostly shift from something like
const Fastify = require('fastify')toimport Fastify from 'fastify', which makes things, such asconst app = require('fastify')({ logger: true })impossible. Also, it's less of a mind-shifting to use the same terms for the same thing (using the termappinstead of usingfastifyorserverfor actually the same thing)Currently, these are the two variations:
JavaScript (shortened):
TypeScript (shortened):
Example
With this proposal, the above examples and all examples throughout the documentation would be unified in terms of how to name and initialize the app. Also, the example of directly importing and initializing the app in one step will be split up into an import and a separate initialization. This avoids varying terms like
fastifyandserverfor actually the same thing.JavaScript (shortened):
TypeScript (shortened):