-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (29 loc) · 714 Bytes
/
index.js
File metadata and controls
34 lines (29 loc) · 714 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
import express from 'express'
import cors from 'cors'
import connectDB from './config/dbConnection.js'
import routes from "./routes/index.js";
import env from "dotenv";
env.config();
//app config
const PORT = process.env.POST || 5500
const app = express();
// db config
connectDB();
// middleware
app.use(express.json());
app.use(
cors({
origin: [
"https://cleanslate.netlify.app",
"http://localhost:5173",
"http://localhost:3000",
],
credentials: true,
})
);
app.get("/", (req,res)=>res.send("Running API"))
// calling routes from routes folder index js
app.use("/api", routes);
app.listen(PORT,()=>{
console.log("Server Listening on Port ",PORT);
})