-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (40 loc) · 1.49 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import express from 'express';
// Import the routes
import userRouter from './routes/userRouter.js';
import chatbotRouter from './routes/chatbotRouter.js';
import contentRouter from './routes/contentRouter.js';
import hotelsRouter from './routes/hotelsRouter.js';
import foodsRouter from './routes/foodsRouter.js';
import roomRouter from './routes/roomRouter.js';
import appsRouter from './routes/appsRouter.js';
// Import the config file
import config from './config/config.js'
// Import the database connection
import db from './apis/db/cosmosDB.js'
import cache from './apis/cache/redisCache.js'
// Import services
import { sendTelegramMessage } from './apis/services/telegram.js'
import { sendEmail } from './apis/services/mail.js'
import { swaggerUi, swaggerSpec } from './swagger.js';
import expressPartials from 'express-partials';
const app = express();
// Install body parser
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// Use EJS template
app.set('view engine', 'ejs');
app.set('views', './views');
// Use expressPartials
app.use(expressPartials());
// Implemenet the swagger for API documentation
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
app.use('/', contentRouter)
app.use('/users', userRouter)
app.use('/chatbot', chatbotRouter)
app.use('/hotels', hotelsRouter)
app.use('/foods', foodsRouter)
app.use('/rooms', roomRouter)
app.use('/apps', appsRouter)
app.listen(config.server.port, ()=>{
console.log(`server runnig on port ${config.server.port}`)
})