-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
42 lines (30 loc) · 943 Bytes
/
app.js
File metadata and controls
42 lines (30 loc) · 943 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint-disable no-undef */
import express from 'express';
import dotenv from 'dotenv';
import logger from './src/api/logger/index.js';
import userRoute from './src/api/routes/user.route.js';
import otpRoute from './src/api/routes/otp.route.js';
import transactionRoute from './src/api/routes/transaction.route.js';
import invalidRoute from './src/api/routes/invalid.route.js';
import verifyUser from './src/api/middlewares/jwt.middleware.js';
dotenv.config();
const app = express();
// req input phraser
app.use(express.json());
// jwt token and session checker
app.use(verifyUser);
// user routes
app.use(userRoute);
// transaction routes
app.use(transactionRoute);
// otp routes
app.use(otpRoute);
// invalid route handler
app.use(invalidRoute);
app.get('/', (req, res) => {
res.send('Hey');
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () =>
logger.info(`App listening to http://localhost:${PORT}`)
);