Remove https now handled by nginx
This commit is contained in:
parent
66c01a350d
commit
d90c7302e7
14
app.js
14
app.js
@ -4,20 +4,10 @@ var path = require('path');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var logger = require('morgan');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
|
||||
const hostname = 'petrov.nexus';
|
||||
const httpPort = 4080;
|
||||
//const httpsPort = 443;
|
||||
|
||||
// const httpsOptions = {
|
||||
// key: fs.readFileSync('./archive/server.key'),
|
||||
// cert: fs.readFileSync('./archive/petrov_nexus.crt'),
|
||||
// ca: fs.readFileSync('./archive/petrov_nexus.ca-bundle')
|
||||
// };
|
||||
|
||||
// vključimo mongoose in ga povežemo z MongoDB
|
||||
var mongoose = require('mongoose');
|
||||
var mongoDB = "mongodb://127.0.0.1/my_database";
|
||||
mongoose.connect(mongoDB);
|
||||
@ -30,7 +20,6 @@ db.on('error', console.error.bind(console, 'MongoDB connection error:'));
|
||||
var app = express();
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
//const httpsServer = https.createServer(httpsOptions, app);
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
@ -67,8 +56,5 @@ app.use(function (err, req, res, next) {
|
||||
httpServer.listen(httpPort, () => {
|
||||
console.log(`Server running at http://${hostname}:${httpPort}/`);
|
||||
});
|
||||
// httpsServer.listen(httpsPort, () => {
|
||||
// console.log(`Server running at https://${hostname}:${httpsPort}/`);
|
||||
// });
|
||||
|
||||
module.exports = app;
|
90
bin/www
90
bin/www
@ -1,90 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('web:server');
|
||||
var http = require('http');
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
// var port = normalizePort(process.env.PORT || '3000');
|
||||
// app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
//server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
// function normalizePort(val) {
|
||||
// var port = parseInt(val, 10);
|
||||
|
||||
// if (isNaN(port)) {
|
||||
// // named pipe
|
||||
// return val;
|
||||
// }
|
||||
|
||||
// if (port >= 0) {
|
||||
// // port number
|
||||
// return port;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
"dev": "nodemon ./bin/www"
|
||||
"start": "node ./app.js",
|
||||
"dev": "nodemon ./app.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"connect-mongo": "^5.0.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user