-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·55 lines (38 loc) · 1.16 KB
/
server.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
#!/usr/bin/env node
var path = require('path');
var express = require('express');
var app = express();
var http = require('http').Server(app);
var hbs = require('express-handlebars');
var cors = require('cors');
var bodyParser = require('body-parser');
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// app.use(morgan('combined'))
app.use(express.static(__dirname + '/public'));
var portnumber = process.env.PORT || 3000;
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
/* Routing PART*/
app.get('/home', function(req, res){
res.render("home");
});
app.get('/dashboard', function(req, res){
res.render("dashboard");
});
app.get('/blog_home', function(req, res){
res.render("blog_home");
});
app.get('/blog_user_profile', function(req, res){
res.render("blog_user_profile");
});
app.get('/blog_create', function(req, res){
res.render("blog_create");
});
app.get('/blog_post/:blog_hash',function(req,res){
res.render("blog_post",{blog_hash : req.params.blog_hash});
})
http.listen(portnumber, function () {
console.log('Dorylus server is listening on port!'+portnumber);
})