-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
88 lines (77 loc) · 3.7 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Khai báo tỗng
const express = require('express');
const fileUpload = require('express-fileupload');
const app = express();
const cors = require('cors');
require('dotenv').config();
const bodyParser = require('body-parser');
app.use(cors());
app.use(express.json());
// Send Data: Client <=> Server
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(fileUpload());
//
require('./scheduler');
// Khai báo module
const sliderRouter = require('./api/Slider/slider.router');
const roomTypeRouter = require('./api/RoomType/roomType.router');
const imageRoomTypeRouter = require('./api/ImageRoomType/imageRoomType.router');
const serviceRouter = require('./api/Service/service.router');
const imageServiceRouter = require('./api/ImageService/imageService.router');
const dailyRateRouter = require('./api/DailyRate/dailyRate.router');
const userRouter = require('./api/User/user.router');
const khdRouter = require('./api/KhachHangDat/khd.router');
const adminRouter = require('./api/Admin/admin.router');
const paypalRouter = require('./api/Payments/paypal.router');
// const stripeRouter = require('./api/Payments/Stripe.router');
const specialRateRouter = require('./api/SpecialRate/specialRate.router');
const roomRouter = require('./api/Room/room.router');
const detailBookServiceRouter = require('./api/BookServiceDetail/BSD.router');
const bookingServiceRouter = require('./api/BookingService/bookingService.router');
const bookingRouter = require('./api/Booking/booking.router');
const detailBookingRouter = require('./api/BookingDetail/BookingD.router');
const detailBillRouter = require('./api/BillDetail/BillD.router');
const customerStayRouter = require('./api/CustomerStay/CustomerStay.router');
const saleOffRouter = require('./api/SaleOff/SaleOff.router');
const billRouter = require('./api/Bill/Bill.router');
const rrcRouter = require('./api/RoomRentalContract/RRC.router');
const resetPassRouter = require('./api/ResetPass/resetPass.router');
const extraFeeRouter = require('./api/ExtraFee/extraFee.router');
const surchargePriceRouter = require('./api/SurchargePrice/surchargePrice.router');
// const payerRouter = require('./api/Payer/Payer.router');
const sendmailRouter = require('./api/Mail/mail.router');
const chartRouter = require('./api/Chart/chart.router');
app.get('/', (req, res) => res.sendFile(__dirname + "/index.html"));
//code API
app.use('/api/slider', sliderRouter);
app.use('/api/roomtype', roomTypeRouter);
app.use('/api/roomtype-image', imageRoomTypeRouter);
app.use('/api/service', serviceRouter);
app.use('/api/service-image', imageServiceRouter);
app.use('/api/daily-rate', dailyRateRouter);
app.use('/api/special-rate', specialRateRouter);
app.use('/api/user', userRouter);
app.use('/api/khd', khdRouter);
app.use('/api/room', roomRouter);
app.use('/api/detail-book-service', detailBookServiceRouter);
app.use('/api/booking-service', bookingServiceRouter);
app.use('/api/booking', bookingRouter);
app.use('/api/detail-booking', detailBookingRouter);
app.use('/api/detail-bill', detailBillRouter);
app.use('/api/customer-stay', customerStayRouter);
app.use('/api/sale-off', saleOffRouter);
app.use('/api/bill', billRouter);
app.use('/api/rrc', rrcRouter);
app.use('/api/reset-pass', resetPassRouter);
app.use('/api/extra-fee', extraFeeRouter);
app.use('/api/surcharge-price', surchargePriceRouter);
// app.use('/api/payer', payerRouter);
app.use('/api/admin', adminRouter);
app.use('/api/pay', paypalRouter);
// app.use('/api/payments', stripeRouter);
app.use('/api/mail', sendmailRouter);
app.use('/api/chart', chartRouter);
app.listen(process.env.PORT||process.env.APP_PORT, () => {
console.log("Server running on http://127.0.0.1:"+ process.env.APP_PORT||process.env.APP_PORT +"...");
});