-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (31 loc) · 887 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
34
35
36
37
38
39
40
41
const express = require('express');
const path = require('path');
const app = express();
const port = 8000;
// for scss
const nodeSassMiddleware = require('node-sass-middleware');
// middleware for using scss
app.use(nodeSassMiddleware({
src: './assets/scss',
dest: './assets/css',
debug: true,
outputStyle: 'extended',
prefix: '/css'
}));
// using static files
app.use(express.static('./assets'));
// setting up the views for ejs
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.get('/', function(req, res){
return res.render('home');
});
// server is listening on port 8000
app.listen(process.env.PORT || port, function(err){
if(err){
console.log('Error in connecting the express server', err);
return;
}
console.log('Express server is up and running on port:', port);
return;
});