SGAppsServerResponse

SGAppsServerResponse

new SGAppsServerResponse(response, server)

Source:
Parameters:
Name Type Description
response ServerResponse
server SGAppsServer

Members

_destroy :Array.<function()>

Source:

Array of functions to be called on response end

Type:
  • Array.<function()>

_flags :object

Source:
Properties:
Name Type Description
finished boolean

will be true if response.end() has been called.

sent boolean

Is true if all data has been flushed to the underlying system, immediately before the 'finish' event is emitted.

closed boolean

Indicates that the the response is completed, or its underlying connection was terminated prematurely (before the response completion).

Array of functions to be called on response end

Type:
  • object

response :ServerResponse

Source:
Type:
  • ServerResponse

Methods

pipeFile(filePath, callback)

Source:
Parameters:
Name Type Description
filePath string
callback SGAppsServerErrorOnlyCallback

represents a Function(Error)

pipeFileStatic(filePath, fileName, callback, optionsopt)

Source:
Parameters:
Name Type Attributes Description
filePath string
fileName string
callback SGAppsServerResponse.pipeFileStaticCallback
options object <optional>
Properties
Name Type Attributes Default Description
timeout number <optional>
0
filePath string <optional>

originap path is autoIndex was applied

autoIndex Array.<string> <optional>

list of auto-index files, ex: ['index.html', 'index.htm', 'default.html']

redirect(url, optionsopt)

Source:

if it returns false than the action was not possible

Parameters:
Name Type Attributes Description
url string
options object <optional>
Properties
Name Type Attributes Default Description
statusCode number <optional>
302
headers Object.<string, (string|Array.<string>)> <optional>

send(data, optionsopt)

Source:
Parameters:
Name Type Attributes Description
data string | Buffer | object | Array.<any>
options object <optional>
Properties
Name Type Attributes Default Description
statusCode number <optional>
200
headers Object.<string, (string|Array.<string>)> <optional>

sendError(error, optionsopt)

Source:
Parameters:
Name Type Attributes Description
error Error
options object <optional>
Properties
Name Type Attributes Default Description
statusCode number <optional>
500

sendStatusCode(statusCode)

Source:
Parameters:
Name Type Description
statusCode number

Type Definitions

pipeFileStaticCallback(error)

Source:
Parameters:
Name Type Description
error Error