server.js — fastify Source File
Architecture documentation for server.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const http = require('node:http')
const https = require('node:https')
const http2 = require('node:http2')
const dns = require('node:dns')
const os = require('node:os')
const { kState, kOptions, kServerBindings, kHttp2ServerSessions } = require('./symbols')
const { FSTWRN003 } = require('./warnings')
const { onListenHookRunner } = require('./hooks')
const {
FST_ERR_REOPENED_CLOSE_SERVER,
FST_ERR_REOPENED_SERVER,
FST_ERR_LISTEN_OPTIONS_INVALID,
FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE
} = require('./errors')
const noopSet = require('./noop-set')
const PonyPromise = require('./promise')
module.exports.createServer = createServer
function defaultResolveServerListeningText (address) {
return `Server listening at ${address}`
}
function createServer (options, httpHandler) {
const server = getServerInstance(options, httpHandler)
// `this` is the Fastify object
function listen (
listenOptions = { port: 0, host: 'localhost' },
cb = undefined
) {
if (typeof cb === 'function') {
if (cb.constructor.name === 'AsyncFunction') {
FSTWRN003('listen method')
}
listenOptions.cb = cb
}
if (listenOptions.signal) {
if (typeof listenOptions.signal.on !== 'function' && typeof listenOptions.signal.addEventListener !== 'function') {
throw new FST_ERR_LISTEN_OPTIONS_INVALID('Invalid options.signal')
}
// copy the current signal state
this[kState].aborted = listenOptions.signal.aborted
if (this[kState].aborted) {
return this.close()
} else {
const onAborted = () => {
this[kState].aborted = true
this.close()
}
listenOptions.signal.addEventListener('abort', onAborted, { once: true })
}
}
// ... (382 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does server.js do?
server.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in server.js?
server.js defines 9 function(s): createCloseHttp2SessionsByHttp2Server, createServer, defaultResolveServerListeningText, getAddresses, getServerInstance, listenCallback, listenPromise, logServerAddress, multipleBindings.
Where is server.js in the architecture?
server.js is located at lib/server.js (domain: CoreKernel, subdomain: LifecycleManager, directory: lib).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free