Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2d5b017
[imad-console] Updates ui/index.html
pawks Aug 6, 2017
42d6973
Made some changes Locally
pawks Aug 6, 2017
52e988e
[imad-console] Updates server.js
pawks Aug 7, 2017
f1ffe71
Create article-one.html
pawks Aug 7, 2017
b38b375
Create article-two.html
pawks Aug 7, 2017
b17deb6
Create article-three.html
pawks Aug 7, 2017
035f854
[imad-console] Updates server.js
pawks Aug 7, 2017
efb06d1
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
50dd646
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
7d93dce
[imad-console] Updates ui/article-three.html
pawks Aug 7, 2017
81a51b8
[imad-console] Updates ui/article-two.html
pawks Aug 7, 2017
81d78a7
[imad-console] Updates server.js
pawks Aug 7, 2017
7cb44cc
[imad-console] Updates server.js
pawks Aug 7, 2017
99cfa73
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
94c2b49
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
710acbb
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
087de16
[imad-console] Updates ui/article-three.html
pawks Aug 7, 2017
b33efe9
[imad-console] Updates ui/style.css
pawks Aug 7, 2017
fe133d3
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
04eef92
[imad-console] Updates ui/article-two.html
pawks Aug 7, 2017
2adeaa0
[imad-console] Updates ui/article-three.html
pawks Aug 7, 2017
8537aab
[imad-console] Updates ui/article-one.html
pawks Aug 7, 2017
9595eab
[imad-console] Updates ui/article-two.html
pawks Aug 7, 2017
81126d9
[imad-console] Updates server.js
pawks Aug 8, 2017
2f62ff4
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
3b8b303
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
d8122e8
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
7cb49da
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
5e6548a
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
b695a43
[imad-console] Updates server.js
pawks Aug 8, 2017
e7c6561
[imad-console] Updates server.js
pawks Aug 8, 2017
15eb100
[imad-console] Updates server.js
pawks Aug 8, 2017
22c1e06
[imad-console] Updates server.js
pawks Aug 8, 2017
db7fd16
[imad-console] Updates server.js
pawks Aug 8, 2017
05699a5
[imad-console] Updates server.js
pawks Aug 8, 2017
0277c75
[imad-console] Updates server.js
pawks Aug 8, 2017
3130c92
Delete article-one.html
pawks Aug 8, 2017
0a77645
Delete article-three.html
pawks Aug 8, 2017
0509128
Delete article-two.html
pawks Aug 8, 2017
5da6dbd
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
85d937d
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
efdbd31
[imad-console] Updates server.js
pawks Aug 8, 2017
40120b4
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
e595346
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
d35dc2a
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
00d910e
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
114b085
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
1d3dee5
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
22ecc7d
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
43498c5
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
489f0e6
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
5393408
[imad-console] Updates ui/style.css
pawks Aug 8, 2017
830fd30
[imad-console] Updates ui/main.js
pawks Aug 8, 2017
74ba7f3
[imad-console] Updates ui/index.html
pawks Aug 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,82 @@ var path = require('path');
var app = express();
app.use(morgan('combined'));

var articles = {
'article-two': {
title: ' Article Two | S.Pawan Kumar',
heading: ' Article Two',
date: 'August 8,2017.',
content: `
<p>
This is the content for the second article.
</p>`
},
'article-one' : {
title: 'Article One | S.Pawan Kumar',
heading: ' Article One',
date: 'August 7,2017.',
content: `
<p>
This is the content for the first article.This is the content for the first article.This is the content for the first article.This is the content for the first article.This is the content for the first article.This is the content for the first article.This is the content for the first article.This is the content for the first article.
</p>`
},
'article-three': {
title: ' Article Three | S.Pawan Kumar',
heading: ' Article Three',
date: 'August 9,2017.',
content: `
<p>
This is the content for the third article.
</p>`
}
};
function CreateTemplate(data)
{ var title=data.title;
var date=data.date;
var heading=data.heading;
var content=data.content;
var HtmlTemplate=`
<html>
<head>
<title>
${title}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/ui/style.css" rel="stylesheet" />
</head>
<body>
<div class="container">
<div>
<a href="/">Home</a>
</div>
<hr/>
<h3>
${heading}
</h3>
<div>
${date}
</div>
<div>
${content}
</div>
</div>
</body>
</html>`
return HtmlTemplate;
}
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'index.html'));
});

app.get("/:articleName",function(req,res){
var articleName = req.params.articleName;
res.send(CreateTemplate(articles[articleName]));
});
app.get('/ui/main.js', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'main.js'));
});


app.get('/ui/style.css', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'style.css'));
});
Expand Down
10 changes: 7 additions & 3 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
</head>
<body>
<div class="center">
<img src="/ui/madi.png" class="img-medium"/>
<img id = 'madi' src="/ui/madi.png" class="img-medium"/>
</div>
<br>
<div class="center text-big bold">
Hi! I am your webapp.
<div id="maintext" class="center text-big bold">
Hi! I am Pawan, this is my first web app.

</div>
<script>
alert('Hi,I\'m a Javascript');
</script>
<script type="text/javascript" src="/ui/main.js">
</script>
</body>
Expand Down
11 changes: 11 additions & 0 deletions ui/main.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
console.log('Loaded!');
var element=document.getElementById('maintext');
element.innerHTML='New Value';
var img=document.getElementById('madi');
var marginleft = 0;
function moveright(){
marginleft = marginleft + 1;
img.marginleft = marginleft + 'px';
}
img.onclick = function(){
var interval = setInterval(moveright,50);
};
52 changes: 30 additions & 22 deletions ui/style.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
body {
font-family: sans-serif;
background-color: lightgrey;
margin-top: 75px;
}

.center {
text-align: center;
}

.text-big {
font-size: 300%;
}

.bold {
font-weight: bold;
}

.img-medium {
height: 200px;
}

body {
font-family: sans-serif;
/*background-color: lightgrey;*/
margin-top: 75px;
}

.center {
text-align: center;
}

.text-big {
font-size: 300%;
}

.bold {
font-weight: bold;
}

.img-medium {
height: 200px;
}
.container{
font-family: sans-serif;
color:#454343;
max-width: 800px;
margin: 0 auto;
padding-top: 60px;
padding-right: 5px;
padding-left: 5px;
}