Class: ServerAPI

ServerAPI(setup)

new ServerAPI(setup)

Creates an instance of ServerAPI.

Parameters:
Name Type Description
setup Object

Configuration options for the server.

Properties
Name Type Description
projectName string

The name of the project.

databaseConfig Object

Configuration options for the database.

API_SECRET string

The API secret key for session encryption.

sessionCookiesMaxAge number

Maximum age of session cookies (in milliseconds).

staticPath string

The path to static files.

listenCallback function

Callback function to be executed when the server starts listening.

compileFE boolean

Flag indicating whether to compile frontend code (defaults to false).

jsonLimit string

Limit of JSON requests (defaults to '10mb').

sessionResave boolean

Flag indicating whether to save session data back to the session store (defaults to true).

sessionSaveUninitialized boolean

Flag indicating whether to save uninitialized sessions to the session store (defaults to true).

keySSLPath string

The path to the SSL key file.

certSSLPath string

The path to the SSL certificate file.

PORT number

The port number on which the server will listen (defaults to 80).

Source:

Methods

createEndpoint(endpoint)

Creates an endpoint for the server.

Parameters:
Name Type Description
endpoint Endpoint

The endpoint to be created.

Source:
Throws:

If the endpoint parameter is not an instance of the Endpoint class.

Type
Error.Log

init()

Initializes the server, setting up routes, middleware, and listeners.

Source:

listen(PORT, callback)

Starts the server to listen on the specified port.

Parameters:
Name Type Description
PORT number

The port number on which the server will listen.

callback function

Callback function to be executed when the server starts listening.

Source:

listenSSL(PORT, keySSLPath, certSSLPath, callback)

Starts the server with SSL encryption to listen on the specified port.

Parameters:
Name Type Description
PORT number

The port number on which the server will listen.

keySSLPath string

The path to the SSL key file.

certSSLPath string

The path to the SSL certificate file.

callback function

Callback function to be executed when the server starts listening.

Source:

runAppQueue()

Runs the queued application functions.

Source: