'use strict'
const express = require('express')
const session = require('express-session')
const helmet = require('helmet')
const bodyParser = require('body-parser')
const form = require('multer')()
const app = express()

const PassGen = require('./model/passgenerator.js')
const BlockChain = require('./model/BlockChain.js')

const Config = require('./config/Config.js')
const config = new Config()

app.use(helmet())
app.use(helmet.referrerPolicy({ policy: 'same-origin' }))

app.get('/',(req, res, next) => {
	if (req.secure || process.env.OPERATION_MODE === 'DEV') {
		next()
	} else{
		// console.log("https://" + req.hostname)
		res.redirect('https://ezkeytopass.herokuapp.com')
	}
})

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.set('view engine', 'ejs')
app.use('/src', express.static('./views/src'))
app.use('/layout', express.static('./views/layout'))
app.use('/views', express.static('./views'))
app.set('port', (process.env.PORT || 5000))
app.use('/passgen', PassGen)
app.use('/blockchain', BlockChain)

app.get('/', function (req, res, next) {
  // console.log("https://" + req.hostname + req.url)
  res.render('pages/index')
})

app.get('/newblock', function (req, res, next) {
  res.render('pages/createnewblock')
})

app.get('(error_page|*)' , function ( req , res , next) {
    res.status(404).render ('pages/error_page')
})

app.listen(app.get('port'), () => {
  console.log('Server is running at this : ' + app.get('port'))
})

@@ -564,16 +564,42 @@
 DEV') %7B%0A
+%09%09console.log(req.secure)%0A
 %09%09next()
@@ -704,16 +704,28 @@
 p.com')%0A
+%09%09// next()%0A
 %09%7D%0A%7D)%0A%0Aa

test again