aadhaar-kiosk-web-app/server/index.js

28 lines
748 B
JavaScript

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';
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);
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));