-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
35 lines (31 loc) · 1.11 KB
/
app.ts
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
import express from 'express';
import mongoose from 'mongoose';
import authRoutes from './routes/auth';
import blogRouter from "./routes/blogPost";
import swaggerUi from 'swagger-ui-express';
import swaggerFile from './swagger-output.json';
import S3Upload from "./routes/upload";
import Chat from "./routes/chat";
import payment from './routes/stripe';
// import msg from "./routes/chat";
// import multer from 'multer';
//Some changes for git configuration
const app = express();
const port = process.env.PORT;
app.use(express.json());
app.use('/auth', authRoutes,swaggerUi.serve, swaggerUi.setup(swaggerFile));
app.use('/post', blogRouter);
app.use('/upload', S3Upload);
app.use('/message', Chat);
app.use('/payment',payment);
// app.use('/message', msg,swaggerUi.serve, swaggerUi.setup(swaggerFile) );
mongoose.connect('mongodb://127.0.0.1:27017/databaseUser')
.then(() => {
console.log('Connected to MongoDB');
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
})
.catch((error) => {
console.error('Error connecting to MongoDB', error);
});