-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (29 loc) · 879 Bytes
/
app.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
31
32
33
34
35
36
import express from "express";
import cors from "cors";
import dotenv from "dotenv";
import Authrouter from "./router/auth/authRouter.js";
import AdminRouter from "./router/admin/adminRouter.js";
import ChatBotRouter from './router/bot/BotRouter.js'
import { mongodb } from "./config/connaction.js";
dotenv.config();
const app = express();
const port = process.env.PORT || 4444;
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
//cors connecting
app.use(
cors({
origin: "https://healtether.netlify.app",
methods: ["GET", "POST", "PUT", "PATCH", "DELETE"],
credentials: true,
})
);
//database connecting
mongodb();
app.use("/", Authrouter);
app.use("/admin", AdminRouter);
app.use("/chat", ChatBotRouter);
const server = app.listen(port, () => {
console.log("server running !!!!!");
console.log(`http://localhost:${port}`);
});