这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4d34514
[imad-console] Updates ui/index.html
saif-shines Sep 20, 2016
f004f49
[imad-console] Updates server.js
saif-shines Sep 23, 2016
302fb2d
[imad-console] Updates server.js
saif-shines Sep 23, 2016
96ce0d2
Create article-one.html
saif-shines Sep 23, 2016
79c53b0
[imad-console] Updates server.js
saif-shines Sep 23, 2016
a31ab19
[imad-console] Updates ui/article-one.html
saif-shines Sep 23, 2016
ddd5010
[imad-console] Updates ui/article-one.html
saif-shines Sep 23, 2016
eb0ee05
Create article-two.html
saif-shines Sep 23, 2016
922d6b5
Create article-three
saif-shines Sep 23, 2016
224b6bf
Rename article-three to article-three.html
saif-shines Sep 23, 2016
b4f4694
[imad-console] Updates server.js
saif-shines Sep 23, 2016
0d84291
[imad-console] Updates ui/article-two.html
saif-shines Sep 23, 2016
81d3f76
[imad-console] Updates ui/article-two.html
saif-shines Sep 23, 2016
d355e93
[imad-console] Updates ui/article-two.html
saif-shines Sep 23, 2016
4631d37
[imad-console] Updates ui/article-one.html
saif-shines Sep 23, 2016
0a29288
[imad-console] Updates ui/article-three.html
saif-shines Sep 23, 2016
ca50c8e
[imad-console] Updates server.js
saif-shines Sep 23, 2016
761b3ec
[imad-console] Updates ui/article-three.html
saif-shines Sep 23, 2016
2b2b822
[imad-console] Updates ui/style.css
saif-shines Sep 23, 2016
51d90be
[imad-console] Updates ui/article-one.html
saif-shines Sep 23, 2016
a930550
[imad-console] Updates ui/article-two.html
saif-shines Sep 23, 2016
cb9cbfb
[imad-console] Updates server.js
saif-shines Sep 25, 2016
be037c2
[imad-console] Updates ui/article-two.html
saif-shines Sep 25, 2016
5ff426b
[imad-console] Updates server.js
saif-shines Sep 25, 2016
b4a0b9b
[imad-console] Updates ui/index.html
saif-shines Sep 25, 2016
b75c282
[imad-console] Updates server.js
saif-shines Oct 28, 2016
41f31b6
[imad-console] Updates ui/index.html
saif-shines Oct 28, 2016
585ed5e
Create jseyes.js
saif-shines Oct 28, 2016
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
160 changes: 136 additions & 24 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,136 @@
var express = require('express');
var morgan = require('morgan');
var path = require('path');

var app = express();
app.use(morgan('combined'));

app.get('/', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'index.html'));
});

app.get('/ui/style.css', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'style.css'));
});

app.get('/ui/madi.png', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'madi.png'));
});


var port = 8080; // Use 8080 for local development because you might already have apache running on 80
app.listen(8080, function () {
console.log(`IMAD course app listening on port ${port}!`);
});
// Calling the express Framework of JavaScript, which manages port, lisetening extra.
var express = require('express');
// This morgan is used to log, the request details.
var morgan = require('morgan');
var path = require('path');

var app = express();
//This tells express to log via morgan
//and morgan to log in the "combined" pre-defined format
app.use(morgan('combined'));
/*
// This *articles* is key-format !
// aritcles* holds three keys - `article-one`, `article-two`, `article-three`
// Each again has its own key-variables - `title`,`heading`,`date`,`content`
var articles = {
'article-one': {
title: 'Article One | Saif Shines',
heading: 'Article One',
date: 'Sep 20, 2016',
content: `
<p>
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
</p>
<p>
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
</p>
<p>
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
This is the content for my first article. This is the content for my first article.
</p>`
},
'article-two': {
title: 'Article Two | Saif Shines',
heading: 'Article Two',
date: 'Sep 24, 2016',
content: `
<p>
This is the content for my second article.
</p>`
},
'article-three': {
title: 'Article Three | Saif Shines',
heading: 'Article Three',
date: 'Sep 29, 2016',
content: `
<p>
This is the content for my 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'));
});

var counter = 0;
app.get('/counter', function (req, res) {
counter = counter + 1;
res.send(counter.toString());
});

var names = [];
app.get('/submit-name', function(req, res) { // /submit-name?name=xxxx
// Get the name from the request
var name = req.query.name;

names.push(name);
// JSON: Javascript Object Notation
res.send(JSON.stringify(names));
});

app.get('/:articleName', function (req, res) {
// articleName == article-one
// articles[articleName] == {} content object for article one
var articleName = req.params.articleName;
res.send(createTemplate(articles[articleName]));
});

app.get('/ui/style.css', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'style.css'));
});

app.get('/ui/main.js', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'main.js'));
});

app.get('/ui/madi.png', function (req, res) {
res.sendFile(path.join(__dirname, 'ui', 'madi.png'));
});

var port = 8080; // Use 8080 for local development because you might already have apache running on 80
app.listen(8080, function () {
console.log(`IMAD course app listening on port ${port}!`);
});
37 changes: 37 additions & 0 deletions ui/article-one.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<html>
<head>
<title>
Article One | Saif Shines
</title>
<meta name="viewport" content="width=device-width, intial-scale=1" />
<link href="/ui/style.css" rel="stylesheet" />
</head>
<body>
<div class="container">
<div>
<a href="/">HOME</a>
</div>
<hr/>
<h3>
Article ONe
</h3>
<div>
Sept 23, 2016
</div>
<div>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
</div>
</div>
</body>
</html>
37 changes: 37 additions & 0 deletions ui/article-three.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<html>
<head>
<title>
Article One | Saif Shines
</title>
<meta name="viewport" content="width=device-width, intial-scale=1" />
<link href="/ui/style.css" rel="stylesheet" />
</head>
<body>
<div class="container">
<div>
<a href="/">HOME</a>
</div>
<hr/>
<h3>
Article Three
</h3>
<div>
Sept 23, 2016
</div>
<div>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
</div>
</div>
</body>
</html>
38 changes: 38 additions & 0 deletions ui/article-two.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<html>
<head>
<title>
Article Two | Saif Shines
</title>
<meta name="viewport" content="width=device-width, intial-scale=1" />
<link href="/ui/style.css" rel="stylesheet" />

</head>
<body>
<div class = "container">
<div>
<a href="/">HOME</a>
</div>
<hr/>
<h3>
Article Two !
</h3>
<div>
Sept 23, 2016
</div>
<div>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
<p>
This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.This is my first Para,boss.
</p>
</div>
</div>
</body>
</html>
49 changes: 33 additions & 16 deletions ui/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
<!doctype html>
<html>
<head>
<link href="/ui/style.css" rel="stylesheet" />
</head>
<body>
<div class="center">
<img src="/ui/madi.png" class="img-medium"/>
</div>
<br>
<div class="center text-big bold">
Hi! I am your webapp.
</div>
<script type="text/javascript" src="/ui/main.js">
</script>
</body>
<!DOCTYPE html>
<head>

<title>
Hey look!
</title>

<style type="text/css">
#styl {
float: left;
margin-left: 580px;
margin-top: 200px;
}
</style>

<script src="ui/jseyes.js"></script>

</head>

<body>


<div id="styl">
<p>
Move the cursor around into the<br /> image to see what the effect.
</p>
<script>
jseyes();
</script>
</div>

</body>

</html>
Loading