backend/api/server.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

require('dotenv').config();
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const helmet = require('helmet');
const accountsRoute = require('./routes/accountRoute');
const meetingsRoute = require('./routes/meetingRoute');
2020-05-04 16:47:05 +00:00
const participantsRoute = require('./routes/participantRoute');
2020-05-05 09:34:30 +00:00
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,
}),
);
2020-05-10 22:48:27 +00:00
// TODO: Add validation to all requests
2020-06-17 11:02:52 +00:00
// server.use(expressValidator());
2020-05-10 22:48:27 +00:00
server.use('/api/accounts', accountsRoute);
server.use('/api/meetings', meetingsRoute);
2020-05-04 16:47:05 +00:00
server.use('/api/participants', participantsRoute);
2020-05-05 09:34:30 +00:00
server.use('/api/possible-dates', possibleDatesRoute);
server.use('/api/availability', availabilityRoute);
server.use('/api/auth', authRoute);
2020-06-17 11:21:13 +00:00
server.get("/", (req, res) => {
res.json({
message: `Meeting Planner Backend API :)`,
documentation: `Check out: https://git.armada.digital/meeting-planner/backend`
});
});
module.exports = server;