Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Albin Geraud Kouatcho Nkuigwa
PSE_Projekt
Commits
7d6aa39d
Commit
7d6aa39d
authored
Jun 23, 2018
by
Janik Münzenberger
Browse files
Bugfix
parent
93fe025d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/backend/server.js
View file @
7d6aa39d
...
...
@@ -3,7 +3,6 @@ const mongoose = require('mongoose'),
express
=
require
(
'
express
'
),
bodyParser
=
require
(
'
body-parser
'
),
fileUpload
=
require
(
'
express-fileupload
'
),
os
=
require
(
'
os
'
),
path
=
require
(
'
path
'
),
webpush
=
require
(
'
web-push
'
),
compression
=
require
(
'
compression
'
);
...
...
@@ -15,13 +14,6 @@ const config = require('config');
/** Express initialzer */
const
app
=
express
();
app
.
use
(
req
,
res
,
next
)
{
// check if it is a secure (https) request
// if not redirect to the equivalent https url
!
req
.
secure
?
res
.
redirect
(
'
https://
'
+
req
.
hostname
+
req
.
url
)
:
next
();
}
/** Initizialize logger */
const
winston
=
require
(
'
winston
'
);
winston
.
level
=
process
.
env
.
LOG_LEVEL
||
'
info
'
;
...
...
@@ -35,9 +27,7 @@ app.use(bodyParser.json());
app
.
use
(
bodyParser
.
text
());
if
(
process
.
env
.
NODE_ENV
!==
'
prod
'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
// Add headers
app
.
use
(
function
(
req
,
res
,
next
)
{
...
...
@@ -94,10 +84,9 @@ webpush.setVapidDetails('mailto:a_loic16@yahoo.fr', publicVapidKey, privateVapid
/** Start server */
let
port
=
process
.
env
.
PORT
||
config
.
port
;
app
.
listen
(
port
,
()
=
>
{
console
.
log
(
`Listening on Port:
${
port
}
`
);
})
;
app
.
listen
(
port
,
()
=>
{
winston
.
info
(
`Listening on Port:
${
port
}
`
);
});
/** Exports */
module
.
exports
=
app
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment