-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (34 loc) · 1.11 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
const express = require('express');
const app = express();
const path = require('path');
const sassMiddleware = require('node-sass-middleware');
require('dotenv').config()
// set sass middleware
app.use(
sassMiddleware({
src: path.join(__dirname, '/public/styles/scss'),
dest: path.join(__dirname, '/public/styles'),
debug: false,
outputStyle: 'expanded',
prefix: '/styles'
}),
express.static(__dirname + '/public')
);
// session cookie
const cookieParser = require('cookie-parser')
app.use(cookieParser())
// parse form input from user
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended: false}));
// set view engine
const mustache = require('mustache-express');
app.engine('mustache', mustache());
app.set('view engine', 'mustache');
// create routes file
const applicationRouter = require('./routes/cwRoutes');
app.use('/', applicationRouter);
// create favicon
app.use('/favicon.ico', express.static('images/favicon.ico'));
app.listen(process.env.PORT || 3000, () => {
console.log('Server started on port 3000. Ctrl^c to quit.');
})