/** * Created by WebStorm. * User: martin * Date: 14/05/2020 * Time: 09:13 */ require('dotenv').config(); const express = require('express'); const bodyParser = require('body-parser'); const session = require('express-session'); const path = require('path'); const helmet = require('helmet'); const cors = require('cors'); const app = express(); require('dotenv').config(); const serverPort = process.env.PORT || 3000; const sitePath = '../dist'; app.use(cors()); app.use(helmet()); app.use(session({ 'secret': 'Z4hc5.64X1e', 'resave': true, 'saveUninitialized': true })); app.use(express.static(path.join(__dirname, sitePath))); // parse requests of content-type - application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ 'extended': true })); // parse requests of content-type - application/json app.use(bodyParser.json()); require('./routes/jobs.route')(app); app.listen(serverPort, () => { console.log(`Server is listening on port ${serverPort}`); }); ((() => { console.log('Job Server started'); // doJob(); })());