require('dotenv').config(); 
const express = require('express');
const session = require('express-session');
const bodyParser = require('body-parser');

const authRoutes = require('./routes/auth');
const userRoutes = require('./routes/users');
const widerrufRoutes = require('./routes/widerruf');


const app = express();
app.use(express.static('public'));
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: false }));

app.use(session({
    secret: 'plusfit_secret_key',
    resave: false,
    saveUninitialized: false
}));

app.use('/', authRoutes);
app.use('/users', userRoutes);
app.use('/sepa', require('./routes/sepa'));
app.use('/sepa', require('./routes/sepaExport'));
app.use('/contracts', require('./routes/contracts'));
app.use('/register', require('./routes/register'));
app.use('/company', require('./routes/company'));
app.use('/widerruf', widerrufRoutes);


app.listen(3005, () => {
    console.log('Plusfit läuft auf http://localhost:3005');
});
