-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
33 lines (26 loc) · 823 Bytes
/
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
const express = require('express');
const app = express();
const hbs = express();
const cors = require('cors');
const path = require('path');
//const dotenv = require('dotenv');
//dotenv.config();
const {movieRouter} = require('./routes/movie_search');
const {movieinforouter} = require('./routes/movieinforoute');
app.use(express.json());
app.use(express.urlencoded({
extended: true,
}));
app.use(cors());
app.set('view engine','ejs');
app.set('views', path.join(__dirname + '/views/layout'));
app.use(express.static(path.join(__dirname, '/public')))
app.get('/',(req,res) => {
res.render('home.ejs');
});
app.use('/movie_search',movieRouter);
app.use('/result',movieinforouter);
const PORT = process.env.PORT || 3001;
app.listen(PORT,() => {
console.log(`App running at: http://localhost:${PORT})`)
});