node-http-server

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 13  →  ?path2? @ 14
/server.js
@@ -5,7 +5,6 @@
/*************************************************************************/
 
// Import packages.
const auth = require("http-auth");
const https = require('https');
const http = require('http');
const path = require('path');
@@ -19,17 +18,28 @@
// Local imports.
const handler = require(
path
.resolve(__dirname, 'src', 'handler')
.resolve(
path.dirname(require.main.filename),
'src',
'handler'
)
);
const certs = require(
path
.resolve(__dirname, 'src', 'certs')
.resolve(
path.dirname(require.main.filename),
'src',
'certs'
)
);
 
// Load configuration file.
const config = require(
path
.resolve(__dirname, 'config')
.resolve(
path.dirname(require.main.filename),
'config'
)
);
 
// Get command-line arguments.
@@ -48,13 +58,17 @@
transports: [
new winston.transports.File({
level: 'info',
filename: path.resolve(__dirname, config.log.file),
filename: path.resolve(
path.dirname(require.main.filename),
config.log.file
),
handleExceptions: true,
json: false,
maxsize: 1048576, // 1MiB.
maxFiles: 10, // Ten rotations.
colorize: false,
timestamp: () => moment().format('YYYYMMDDTHHmmss')
timestamp: () => moment()
.format('YYYYMMDDTHHmmss')
}),
new winston.transports.Console({
level: 'info',
@@ -61,7 +75,8 @@
handleExceptions: true,
json: false,
colorize: true,
timestamp: () => moment().format('YYYYMMDDTHHmmss')
timestamp: () => moment()
.format('YYYYMMDDTHHmmss')
})
],
exitOnError: false
@@ -73,12 +88,6 @@
process.exit(1);
}
 
// Create digest authentication.
const authentication = auth.digest({
realm: config.auth.realm,
file: path.resolve(__dirname, config.auth.digest)
});
 
// Start HTTP server.
http.createServer(
// authentication,