fastify() — fastify Function Reference
Architecture documentation for the fastify() function in fastify.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD 54cbea5e_a399_a298_5819_f2791a26c65c["fastify()"] 2bf9986b_b7fb_0c78_f075_72fbe6f4672b["fastify.js"] 54cbea5e_a399_a298_5819_f2791a26c65c -->|defined in| 2bf9986b_b7fb_0c78_f075_72fbe6f4672b 3dc845e9_dc76_1836_b31f_7f87530ebe7f["hasSymbolDisposeWithUsing()"] 3dc845e9_dc76_1836_b31f_7f87530ebe7f -->|calls| 54cbea5e_a399_a298_5819_f2791a26c65c 45e19c0a_281f_4d9e_d80e_a0f033de06ce["hasSymbolDispose()"] 45e19c0a_281f_4d9e_d80e_a0f033de06ce -->|calls| 54cbea5e_a399_a298_5819_f2791a26c65c 61ade40f_2777_d754_2bed_3fac253432e5["processOptions()"] 54cbea5e_a399_a298_5819_f2791a26c65c -->|calls| 61ade40f_2777_d754_2bed_3fac253432e5 3d7f2bcf_c0e7_8919_8897_bf3c3c6a3428["validateSchemaErrorFormatter()"] 54cbea5e_a399_a298_5819_f2791a26c65c -->|calls| 3d7f2bcf_c0e7_8919_8897_bf3c3c6a3428 style 54cbea5e_a399_a298_5819_f2791a26c65c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
fastify.js lines 87–820
function fastify (serverOptions) {
const {
options,
genReqId,
disableRequestLogging,
hasLogger,
initialConfig
} = processOptions(serverOptions, defaultRoute, onBadUrl)
// Default router
const router = buildRouting(options.routerOptions)
// 404 router, used for handling encapsulated 404 handlers
const fourOhFour = build404(options)
// HTTP server and its handler
const httpHandler = wrapRouting(router, options)
const {
server,
listen,
forceCloseConnections,
serverHasCloseAllConnections,
serverHasCloseHttp2Sessions,
keepAliveConnections
} = createServer(options, httpHandler)
const setupResponseListeners = Reply.setupResponseListeners
const schemaController = SchemaController.buildSchemaController(null, options.schemaController)
// Public API
const fastify = {
// Fastify internals
[kState]: {
listening: false,
closing: false,
started: false,
ready: false,
booting: false,
aborted: false,
readyResolver: null
},
[kKeepAliveConnections]: keepAliveConnections,
[kSupportedHTTPMethods]: {
bodyless: new Set([
// Standard
'GET',
'HEAD',
'TRACE'
]),
bodywith: new Set([
// Standard
'DELETE',
'OPTIONS',
'PATCH',
'PUT',
'POST'
])
},
[kOptions]: options,
[kChildren]: [],
[kServerBindings]: [],
[kBodyLimit]: options.bodyLimit,
[kRoutePrefix]: '',
[kLogLevel]: '',
[kLogSerializers]: null,
[kHooks]: new Hooks(),
[kSchemaController]: schemaController,
[kSchemaErrorFormatter]: null,
[kErrorHandler]: buildErrorHandler(),
[kErrorHandlerAlreadySet]: false,
[kChildLoggerFactory]: options.childLoggerFactory || defaultChildLoggerFactory,
[kReplySerializerDefault]: null,
[kContentTypeParser]: new ContentTypeParser(
options.bodyLimit,
(options.onProtoPoisoning || defaultInitOptions.onProtoPoisoning),
(options.onConstructorPoisoning || defaultInitOptions.onConstructorPoisoning)
),
[kReply]: Reply.buildReply(Reply),
[kRequest]: Request.buildRequest(Request, options.trustProxy),
[kFourOhFour]: fourOhFour,
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does fastify() do?
fastify() is a function in the fastify codebase, defined in fastify.js.
Where is fastify() defined?
fastify() is defined in fastify.js at line 87.
What does fastify() call?
fastify() calls 2 function(s): processOptions, validateSchemaErrorFormatter.
What calls fastify()?
fastify() is called by 2 function(s): hasSymbolDispose, hasSymbolDisposeWithUsing.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free