-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·56 lines (44 loc) · 1.45 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
56
const express = require('express');
const {
exec
} = require('child_process');
const app = express();
const port = process.env.PORT || 3000 ;
const ejs = require('ejs');
app.set('view engine','ejs');
app.use(express.static('public'));
app.use(express.urlencoded({
extended: false
}))
app.get('/testing',(req,res)=>{
res.send('name:kenan')
})
app.get('/', (req, res) => {
res.render('index')
})
app.get('/home', (req, res) => {
res.render('index')
})
app.get('/resume',(req,res)=>{
res.render('resume')
})
app.get('/preview/:project_name',(req,res)=>{
const {project_name} = req.params;
const name = project_name
const pages = ['curate','racing','construction', 'eco','portfolio','music']
if(pages.includes(name)) res.render(name)
else {res.redirect('/')}
})
app.get('/blog/:page', (req, res)=>{
res.redirect('https://medium.com/@sdanielkenan')
// let menu = req.query;
// menu = Object.keys(menu).length == true ? true : false ;
// if (req.params.page == "story") res.render('story',{menu:menu});
// if (req.params.page == "git") res.render('git',{menu:menu});
// if (req.params.page == "network") res.render('Networking4SoftwareEngineers',{menu:menu});
// if (req.params.page == "jspro") res.render('debugging',{menu:menu});
})
app.get('/blog' , (req, res)=>{
res.redirect('https://medium.com/@sdanielkenan')
})
app.listen(port);