"use strict";var _process$env$NODE_ENV,_express=_interopRequireDefault(require("express")),_path=_interopRequireDefault(require("path")),_morgan=_interopRequireDefault(require("morgan")),_cookieParser=_interopRequireDefault(require("cookie-parser")),_bodyParser=_interopRequireDefault(require("body-parser")),_helmet=_interopRequireDefault(require("helmet")),_compression=_interopRequireDefault(require("compression"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var env=null!==(_process$env$NODE_ENV=process.env.NODE_ENV)&&void 0!==_process$env$NODE_ENV?_process$env$NODE_ENV:"testing",config=require("./config/config")[env],lang="DE",app=(0,_express["default"])();// import {config} from './config/config'
// app.use(helmet())
// caching disabled for every route
// NOTE: Works in Firefox and Opera. Does not work in Edge
// Handle 404
// Handle 500 - any server error
app.set("port",config.app.port),app.set("views",_path["default"].join(__dirname,"/views")),app.set("view engine","pug"),app.use((0,_compression["default"])()),app.use((0,_morgan["default"])("combined")),app.use((0,_cookieParser["default"])()),app.use(_bodyParser["default"].json()),app.use(_bodyParser["default"].urlencoded({extended:!1})),app.use(_express["default"]["static"](_path["default"].join(__dirname,"public"))),app.use(_helmet["default"].contentSecurityPolicy({useDefaults:!0,directives:{"font-src":["'self'","https://use.fontawesome.com"],"img-src":["'self'","https://transfer.hft-stuttgart.de"],"script-src":["'self'","https://code.jquery.com/jquery-3.3.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js","https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"],"style-src":["'self'","https://use.fontawesome.com/releases/v5.8.2/css/all.css"],"frame-src":["'self'"]},reportOnly:!0})),app.use((0,_compression["default"])()),app.use((0,_morgan["default"])("combined")),app.use((0,_cookieParser["default"])()),app.use(_bodyParser["default"].json()),app.use(_bodyParser["default"].urlencoded({extended:!1})),app.use(_express["default"]["static"](_path["default"].join(__dirname,"public"))),app.use(function(a,b,c){b.set("Cache-Control","no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0"),c()}),require("./routes/project")(app),app.use(function(a,b){b.status(404).render(lang+"/404")}),app.use(function(a,b,c){console.error(a.stack),c.status(500).render(lang+"/500",{error:a})}),app.listen(app.get("port"),function(){console.log("Project Page listening on port "+(app.get("port")+""))});