-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (24 loc) · 958 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const cors = require('cors');
const userRouter = require('./routes/userRouter');
const authenticationRouter = require('./routes/authenticationRouter');
const paymentRouter = require('./routes/paymentRouter');
const intakeRouter = require('./routes/intakeRouter');
const webhookRouter = express.Router();
const apiKeyAuth = require('./middleware/apiKeyAuth');
require('dotenv').config();
const LOCAL_PORT = process.env.PORT || '4321';
app.use(express.json());
app.use(cors());
app.use(bodyParser.urlencoded());
// ----- Routes ------ //
app.use('/api/users', userRouter);
app.use('/api/authentication', authenticationRouter);
app.use('/api/payments', paymentRouter);
app.use('/api/intake', apiKeyAuth, intakeRouter);
app.use('/webhooks', webhookRouter);
app.listen(LOCAL_PORT, () => {
console.log(`Server listening on the port: ${LOCAL_PORT}`);
});