-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (22 loc) · 654 Bytes
/
index.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
import express from "express";
import cors from "cors";
import connectDb from "./mongodb/Connect.js";
import ApiRoutes from "./Routes/ApiRoutes.js";
import PostRoutes from "./Routes/PostRoutes.js";
const app = express();
app.use(cors());
app.use(express.json({ limit: '500mb' }));
app.use('/api/post',ApiRoutes)
app.use('/api/posts',PostRoutes)
app.get('/', (req, res) => {
res.send('hello DALL-E')
});
const startServer = async () => {
try {
connectDb();
app.listen(8080, () => console.log('server started!', 8080));
} catch (error) {
console.log(error)
}
}
startServer();