WhiteDog

I Added logo on the topside

var http = require('http');
http.createServer(function (req, res) {
var path = req.url.replace(/\/?(?:\?.*)?$/, '').toLowerCase();
switch (path) {
case '':
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Homepage');
break;
case '/about':
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('About');
default:
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Not Found');
break;
}
}).listen(3000);
console.log('Server started on localhost:3000; press Ctrl-C to terminate....');
\ No newline at end of file
exports.getWeatherData= function () {
exports.getWeatherData = function () {
return {
locations: [
{
......@@ -6,22 +6,23 @@ exports.getWeatherData= function () {
forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html',
iconUrl: 'http://icons-ak.wxug.com/i/c/k/cloudy.gif',
weather: 'Overcast',
temp: '54.1 F(12.3C',
temp: '54.1 F (12.3 C)',
},
{
name: 'Bend',
forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html',
forecastUrl: 'http://www.wunderground.com/US/OR/Bend.html',
iconUrl: 'http://icons-ak.wxug.com/i/c/k/partlycloudy.gif',
weather: 'Partly Cloudy',
temp: '55.0 F(12.3C',
temp: '55.0 F (12.8 C)',
},
{
name: 'Manzanita',
forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html',
forecastUrl: 'http://www.wunderground.com/US/OR/Manzanita.html',
iconUrl: 'http://icons-ak.wxug.com/i/c/k/rain.gif',
weather: 'Light Rain',
temp: '55.0 F(12.3C',
temp: '55.0 F (12.8 C)',
},
],
};
}
\ No newline at end of file
};
\ No newline at end of file
......
......@@ -55,7 +55,7 @@ app.get('/', function (req, res) {
tours: [
{ name: 'Hood River', price: '$99.95' },
{ name: 'Oregon Coast', price: '$159.95' },],
specialsUrl: '/about',
specialsUrl: 'http://blog.naver.com/gjwodnr3454',
currencies: ['USD', 'GBP', 'BTC'],
};
res.render('home', {
......@@ -66,7 +66,13 @@ app.get('/', function (req, res) {
currencies: product.currencies
});
});
app.get('/about', function (req, res) {
// var randomFortune = fortunes[Math.floor(Math.random() * fortunes.length)];
res.render('about', {
fortune: fortune.getFortune(),
pageTestScript: '/qa/tests-about.js'
});
});
app.get('/tours/hood-river', function (req, res) {
//레이아웃을 쓰지 않으려면 layout:null 넘김
//null 말고 layouts 서브디렉토리에 있는 다른 레이아웃을 써도됨.
......@@ -78,12 +84,16 @@ app.get('/tours/oregon-coast', function (req, res) {
app.get('/tours/request-group-rate', function (req, res) {
res.render('tours/request-group-rate');
});
app.get('/nursery-rhyme', function(req,res){
res.render('nursery-rhyme');
});
app.get('/about', function (req, res) {
// var randomFortune = fortunes[Math.floor(Math.random() * fortunes.length)];
res.render('about', {
fortune: fortune.getFortune(),
pageTestScript: '/qa/tests-about.js'
app.get('/data/nursery-rhyme',function(req,res){
res.json({
animal:'squirrel',
bodyPart:'tail',
adjective:'bushy',
noun:'heck',
});
});
......
This diff is collapsed. Click to expand it.

58.3 KB | W: | H:

6.49 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
......@@ -18,8 +18,8 @@
</ul>
{{! if의 반대래, unless는...}}
{{#unless currencies}}
<p>All prices in {{currency.name}}.</p>
<p>All prices in {{currency.name}}.</p>`
{{/unless}}
{{#if specialsUrl}}
<p>Check out our special at <a href="{{specialsUrl}}">{{specialsUrl}}!</a></p>
<p>You can also check my personal <a href="{{specialsUrl}}">Blog(Korean)</a></p>
{{/if}}
\ No newline at end of file
......
......@@ -2,12 +2,23 @@
<html>
<head>
<title>Meadowlark Travel</title>
{{{_sections.head}}}
{{#if showTests}}
<link rel="stylesheet" href="/vendor/mocha.css"> {{/if}}
<script src="//code.jquery.com/jquery-2.0.2.min.js"></script>
{{! alt -> 사진이 뜨지 않았을때 대체할만한 설명!!}}
{{! CSS style을 이용해서 가운데 정렬}}
<style>
img
{
display:block;
margin-left:auto;
margin-right:auto;
}
</style>
<a href="/"><img src="/img/logo.png" alt="my logo"></a>
{{#if showTests}}
<link rel="stylesheet" href="/vendor/mocha.css">
{{/if}}
{{{_sections.head}}}
<style>
ul {
list-style-type: none;
......@@ -16,6 +27,7 @@
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
......@@ -32,7 +44,6 @@
background-color: #111;
}
</style>
<ul>
<li>
<a class="active" href="/">Home</a>
......@@ -41,7 +52,7 @@
<a href="/about">About</a>
</li>
<li>
<a href="/tours/hood-river">Hood River</a>
<a href="https://www.youtube.com/channel/UCsc9IDPcx0VNbIM07-hu9aw">WhiteDog Youtube</a>
</li>
<li>
<a href="/tours/oregon-coast">Oregon Coast</a>
......@@ -51,12 +62,11 @@
</head>
<body>
<header>
<img src="/img/logo2.png" alt="Meadowlark Travel Logo">
</header>
{{{body}}} {{#if showTests}}
{{{body}}}
<script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
{{{_sections.jquery}}}
{{#if showTests}}
<div id="mocha"></div>
<script src="/vendor/mocha.js"></script>
<script src="/vendor/chai.js"></script>
......@@ -64,9 +74,14 @@
mocha.ui('tdd');
var assert = chai.assert;
</script>
<script src="/qa/tests-global.js"></script> {{#if pageTestScript}}
<script src="{{pageTestScript}}"></script> {{/if}}
<script>mocha.run();</script> {{/if}}
<script src="/qa/tests-global.js"></script>
{{#if pageTestScript}}
<script src="{{pageTestScript}}"></script>
{{/if}}
<script>mocha.run();</script>
{{/if}}
</body>
</html>
\ No newline at end of file
......
{{#section 'head'}}
<script src="//cdnjs.cloudflare.com/ajax.libs/handlebars.js/1.3.0/handlebars.min.js"></script>
<script id="nurseryRhymeTemplate" type="text.x-handlebars-template">
<script id="nurseryRhymeTemplate" type="text/x-handlebars-template">
Marry had a little <b>\{{animal}}</b>, its <b>\{{bodyPart}}</b>
was <b>\{{adjective}}</b> as <b>\{{noun}}</b>.
</script>
{{/section}}
{{! div는 특별한 의미가 있는건 아니고 그냥 가상의 레이아웃을 나누는 태그라고함}}
<div id="nurseryRhyme">Click a button....</div>
<hr>{{! 문단선을 의미! ㅋㅋ 태그 검색하면서 하니 쉽네}}
<button id="btnNurseryRhyme">Generate nursery rhyme</button>
<button id="btnNurseryRhymeAjax">Generate nursery rhyme from AJAX</button>
{{#section 'jquery'}}
<script>
$(document).ready(function () {
var nurseryRhymeTemplate = Handlebars.compile(
$('#nurseryRhymeTemplate').html());
var $nurseryRhyme = $('#nurseryRhyme');
$('#btnNurseryRhyme').on('click', function (evt) {
evt.preventDefault();
$nurseryRhyme.html(nurseryRhymeTemplate({
animal: 'basilisk',
bodyPart: 'tail',
adjective: 'sharp',
noun: 'a needle'
}));
});
$('btnNurseryRhymeAjax').on('click', function (evt) {
evt.preventDefault();
$.ajax('/data/nursery-rhyme', {
success: function (data) {
$nurseryRhyme.html(nurseryRhymeTemplate(data))
}
});
});
});
</script>
{{/section}}
\ No newline at end of file
......