-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
75 lines (49 loc) · 2.19 KB
/
app.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
const express = require("express");
const path = require("path");
require("dotenv").config();
const app = express();
app.use(express.json());
app.use("/public", express.static("public"));
const MovieController = require("./controllers/MovieController");
const MovieDetailController = require("./controllers/MovieDetailController");
const AuthController = require("./controllers/AuthController");
const BookingController = require("./controllers/BookingController");
const RatingController = require("./controllers/RatingController");
const PORT = process.env.PORT || 3000;
const { verifyToken } = require("./middlewares/authMiddleware");
app.use(express.urlencoded({ extended: false }));
app.get("/", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/home/home.html"));
});
app.get("/home", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/home/home.html"));
});
app.get("/login", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/login2/login2.html"));
});
app.get("/register", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/register/Register.html"));
});
app.get("/movies", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/movies/movie.html"));
});
app.get("/book", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/bookTicket/Ticket.html"));
});
app.get("/about", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/explore/AboutUs/aboutUs.html"));
});
app.get("/contact", function (req, res) {
res.sendFile(path.join(__dirname, "./pages/ContactUs/ContactUs.html"));
});
app.route("/movieList").get(MovieController.getAllMovies);
app.route("/movieList/:movie_id").get(MovieDetailController.getMovieDetail);
app.route("/createBooking").post(verifyToken, BookingController.createBooking);
app.route("/userBookings/:user_id").get(BookingController.getBooking);
app.route("/giveRating").post(verifyToken, RatingController.giveRating);
app.route("/signup").post(AuthController.signUp);
app.route("/signin").post(AuthController.signIn);
app.route("/showSeats/:movie_id").get(BookingController.getSeatsOccupancy);
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});