-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
79 lines (72 loc) · 2.53 KB
/
main.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
const express = require("express"); // required for easy server
const path = require("path"); // the path allows us to find the right path to the file to return
const bodyParser = require('body-parser');
const async = require("async");
const fs = require('fs');
const pg = require('pg');
const cors = require('cors');
const PORT = process.env.PORT || 5000;
const corsOptions = {
origin: "https://temphalloweenhost.herokuapp.com/",
optionsSuccessStatus: 200
};
const app = express(); // Makes things easy
//const sequelize = require('./Util/database');
// TODO: add models
app.use(cors(corsOptions));
//const Movie = require('./models/Movie');
// Establish Routes
//const adminRoutes = require('./routes/admin');
//const userRoutes = require('./routes/user');
//const roughRoute = require('./routes/rough');
//const visitorRoutes = require('./Routes/visitor');
app.use(express.static(path.join(__dirname, 'public')))
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(bodyParser.urlencoded({ extended: false}));
app.use(express.static(path.join(__dirname, 'public')));
//const { Sequelize } = require("sequelize/types");
// Check Routes
//app.use('/admin', adminRoutes);
//app.use('/user', userRoutes);
//app.use('/visitor', visitorRoutes);
//app.use('/rough', express.static(path.join(__dirname, 'rough')))
app.use(express.static('views'));
app.use('/index', (req, res, next) => {
res.sendFile('/index.html');
});
app.use('/movies', (req, res, next) => {
res.sendFile( '/movies.html');
});
app.use('/page', (req, res, next) => {
res.sendFile('/page.html');
});
app.use('/trickortreat', (req, res, next) => {
res.sendFile('/trickortreat.html');
});
/*
app.use('/index', (req, res, next) => {
res.sendFile(express.static(path.join__dirname + '/index.html'));
});
app.use('/movies', (req, res, next) => {
res.sendFile(express.static(path.join__dirname + '/movies.html'));
});
app.use('/page', (req, res, next) => {
res.sendFile(express.static(path.join__dirname + '/page.html'));
});
app.use('/trickortreat', (req, res, next) => {
res.sendFile(express.static(path.join__dirname + '/trickortreat.html'));
});
*/
//app.use('/', (req, res, next) => {
// res.render('index', {
// pageTitle: "Movies",
// path: '/movies'
// });
//});
//****************************************************** */
//app.use('/activities',(req, res, next) => {
// res.sendFile(path.join(__dirname,'views', 'HalloweenWeb.html'));
// });
//****************************************************** */
app.listen(PORT);