app.bodyshudhi.com Open in urlscan Pro
103.205.64.121  Public Scan

URL: https://app.bodyshudhi.com/
Submission: On March 31 via api from US — Scanned from US

Form analysis 0 forms found in the DOM

Text Content

const express = require('express');
require('dotenv').config({path :"./config/.env"});
const cors = require('cors');
const db = require("./models/index")
const cookieParser = require("cookie-parser");
const bodyParser = require("body-parser"); 
const errorMiddleware = require("./middleware/error");
const session = require("express-session");
const {sendSmsBodyShuddhi} = require("./utils/sendMsgs");

var SequelizeStore = require("connect-session-sequelize")(session.Store);

const app = express();
app.use(cors());

var myStore = new SequelizeStore({
    db: db.sequelize,
});

app.use(session({
    secret : "this is secret",
    store : myStore,
    saveUninitialized:false,
    resave: false,
    cookie : {httpOnly:true, maxAge : 1000 * 60 * 60 * 24}
}));
myStore.sync();

app.use(bodyParser.json());
app.use(express.json());       
app.use(express.urlencoded({extended: true})); 
var path = require("path")

app.use(express.static(path.join(__dirname, 'public')))

app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));

const connectDb = async() => {
    try {
        await db.sequelize.authenticate();
        console.log('Connection has been established successfully.');
    } catch (error) {
        console.error('Unable to connect to the database:', error);
    }
}

connectDb();

let port = process.env.PORT;
if (port == null || port == "") {
  port = 3003;
}

app.listen(port, function() {
    console.log("Server is running on port", port);
});

const userRoutes = require("./routes/userRoutes");
const locationRoutes = require("./routes/locationRoutes");
const adminRoutes = require("./routes/admin");
const paymentRoutes = require("./routes/payment");

app.use("/api/v1", userRoutes);
app.use("/api/v1", locationRoutes);
app.use("/payment", paymentRoutes);
app.use("/", adminRoutes)
app.use(errorMiddleware);