require('dotenv').config(); const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const helmet = require('helmet'); const logSmtpStatus = require('../services/email/logSmtpStatus'); const accountsRoute = require('./routes/accountRoute'); const meetingsRoute = require('./routes/meetingRoute'); const participantsRoute = require('./routes/participantRoute'); const possibleDatesRoute = require('./routes/possibleDateRoute'); const availabilityRoute = require('./routes/availabilityRoute'); const authRoute = require('./routes/authRoute'); const server = express(); server.use(cors()); server.use(express.json()); server.use(helmet()); server.use(bodyParser.json()); server.use( bodyParser.urlencoded({ extended: true, }), ); // TODO: Add validation to all requests // server.use(expressValidator()); server.use('/api/accounts', accountsRoute); server.use('/api/meetings', meetingsRoute); server.use('/api/participants', participantsRoute); server.use('/api/possible-dates', possibleDatesRoute); server.use('/api/availability', availabilityRoute); server.use('/api/auth', authRoute); // Uncomment to log SMTP status. If config is correct, // the console will output:'SMTP is correctly configured.' // logSmtpStatus(); server.get('/', (req, res) => { res.json({ message: `Meeting Planner Backend API :)`, documentation: `Check out: https://git.armada.digital/meeting-planner/backend`, }); }); module.exports = server;