blob: 2ccd121ac10b7564de4e947fd211fde8d9ef122f (
plain)
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
|
import Express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import cors from 'cors';
import dotenv from 'dotenv';
import userRoutes from './routes/users.js';
import healthRoutes from './routes/health.js';
import otpRoutes from './routes/otp.js';
const app = Express();
dotenv.config();
app.use(bodyParser.json({limit: '30mb', extended: true}));
app.use(bodyParser.urlencoded({limit: '30mb', extended: true}));
app.use(cors());
app.use('/', healthRoutes);
app.use('/', userRoutes);
app.use('/', otpRoutes);
const CONNECTION_URL = process.env.CONNECTION_URL;
const PORT = process.env.PORT;
mongoose
.connect(CONNECTION_URL)
.then(() =>
app.listen(PORT, () => console.log(`Server running on PORT: ${PORT}`))
)
.catch((error) => console.log(error.message));
|