require('dotenv').config(); const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const helmet = require('helmet'); const smtpStatus = require('../helpers/smtpStatus'); 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); const smtpMessage = smtpStatus(); server.get('/', (req, res) => { res.json({ message: `Meeting Planner Backend API :)`, documentation: `Check out: https://git.armada.digital/meeting-planner/backend`, SMTP: `${smtpMessage}`, }); }); module.exports = server;