-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (19 loc) · 855 Bytes
/
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
const express = require('express');
const app = express();
const path = require('path');
const exphbs = require('express-handlebars');
// const routes = require('./routes/api/members');
app.use(express.static(path.join(__dirname, '/views')));
app.engine('handlebars', exphbs({defaultLayout: 'main'}))
app.set('view engine', 'handlebars')
//body parser
app.use(express.json());
app.use(express.urlencoded({ extended: false}))
app.get('/', (req, res) => res.render('index', {}));
app.get('/login', (req, res) => res.render('login', {}));
app.get('/blog', (req, res) => res.render('blog', {}));
app.get('/search', (req, res) => res.render('search', {}));
// app.use('/api/members', require('./routes/api/members'));
//setting server
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => { console.log(`server started o port ${PORT}`) })