/server.js |
@@ -16,7 +16,7 @@ |
const dns = require('dns'); |
|
// Local imports. |
const handler = require( |
const Handler = require( |
path |
.resolve( |
path.dirname(require.main.filename), |
@@ -94,23 +94,19 @@ |
http.createServer( |
// authentication, |
(request, response) => |
handler.process(config, request, response, root, (logging, result) => { |
|
// Log the message by severity. |
log.log(logging.severity, logging.message); |
|
// If no result is to be processed, then terminate the request. |
if (typeof result === 'undefined' || result === null) |
return; |
|
// Set the response status. |
response.status = result.status; |
// Set the content type and send the data. |
response.setHeader('Content-Type', result.type); |
result.data |
.on('readable', () => result.data.pipe(response)) |
.on('end', () => response.end()); |
}) |
new Handler().process(config, request, response, root) |
.on('log', (data) => { |
log.log(data.severity, data.message); |
}) |
.on('data', (result) => { |
// Set the response status. |
response.status = result.status; |
// Set the content type and send the data. |
response.setHeader('Content-Type', result.type); |
result.data |
.on('readable', () => result.data.pipe(response)) |
.on('end', () => response.end()); |
}) |
).listen(config.net.port, config.net.address, () => { |
log.info('HTTP Server accessible at: http://' + |
config.net.address + |
@@ -136,22 +132,19 @@ |
cert: certificates.certificate, |
}, |
(request, response) => |
handler.process(config, request, response, root, (result) => { |
// Log the message by severity. |
log.log(logging.severity, logging.message); |
|
// If no result is to be processed, then terminate the request. |
if (typeof result === 'undefined' || result === null) |
return; |
|
// Set the response status. |
response.status = result.status; |
// Set the content type and send the data. |
response.setHeader('Content-Type', result.type); |
result.data |
.on('readable', () => result.data.pipe(response)) |
.on('end', () => response.end()); |
}) |
new Handler().process(config, request, response, root) |
.on('log', (data) => { |
log.log(data.severity, data.message); |
}) |
.on('data', (result) => { |
// Set the response status. |
response.status = result.status; |
// Set the content type and send the data. |
response.setHeader('Content-Type', result.type); |
result.data |
.on('readable', () => result.data.pipe(response)) |
.on('end', () => response.end()); |
}) |
).listen(config.ssl.port, config.ssl.address, () => { |
log.info('HTTPs Server accessible at: https://' + |
config.ssl.address + |