-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
80 lines (74 loc) · 2.72 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"use-strict"
var express = require('express');
var router = express.Router();
var app = express();
var path = require('path')
app.set('views', __dirname + '/public/views/partials')
app.set('view engine', 'jade')
app.use(express.static(path.resolve('public/assets/')))
app.use('/resume', express.static(__dirname + '/resume/'));
app.get('/gethost', function(req, res) {
var ip;
if (req.headers['x-forwarded-for']) {
ip = req.headers['x-forwarded-for'].split(",")[0]; // for systems behind a proxy
} else if (req.connection && req.connection.remoteAddress) {
ip = req.connection.remoteAddress;
} else {
ip = req.ip;
}
res.send(ip)
})
app.get('/', function(req, res) {
res.render('landing', { title: 'Vishal Ranjan | #Developer #Dreamer #Musician #Traveller #Reader #Writer' })
});
app.get('/projects', function(req, res) {
res.render('projects', { title: 'Projects | Vishal Ranjan' })
});
app.get('/projects/mka', function(req, res) {
res.render('./projects/mka', { title: 'Projects | MKA' })
});
app.get('/projects/open-flush', function(req, res) {
res.render('./projects/openflush', { title: 'Projects | Open Flush' })
});
app.get('/projects/sanepharma', function(req, res) {
res.render('./projects/sanepharma', { title: 'Projects | Sanepharma' })
});
app.get('/projects/mean-machine', function(req, res) {
res.render('./projects/meanmachine', { title: 'Projects | Mean Machine' })
});
app.get('/projects/trail-tracker', function(req, res) {
res.render('./projects/trailtracker', { title: 'Projects | Trail Tracker' })
});
app.get('/projects/ultimate-tic-tac-toe', function(req, res) {
res.render('./projects/tictactoe', { title: 'Projects | Ultimate Tic Tac Toe' })
});
app.get('/projects/snakes-and-ladders', function(req, res) {
res.render('./projects/snakesladders', { title: 'Projects | Snakes and Ladders' })
});
app.get('/about', function(req, res) {
res.render('about', { title: 'About Me | Vishal Ranjan' })
});
app.get('/contact', function(req, res) {
res.render('contact')
});
app.get('/tech', function(req, res) {
res.render('tech', { title: 'Tech Stack | Vishal Ranjan' })
});
app.get('/blog', function(req, res) {
res.redirect('http://www.codelikeapainter.com')
});
app.get('/writings', function(req, res) {
//res.redirect('http://www.codelikeapainter.com')
res.render('medium', { title: 'Moving to a new place | Vishal Ranjan' })
});
app.use(function(req, res, next) {
res.render('404', { title: 'Oops ! | Vishal Ranjan' })
});
app.use(function(err, req, res, next) {
console.error(err.stack);
res.render('500')
});
var port = process.env.PORT || 1339
var server = app.listen(port, function() {
console.log('Magic happens at ', port);
});