WhiteDog

I Added logo on the topside

1 +var http = require('http');
2 +
3 +http.createServer(function (req, res) {
4 + var path = req.url.replace(/\/?(?:\?.*)?$/, '').toLowerCase();
5 + switch (path) {
6 + case '':
7 + res.writeHead(200, { 'Content-Type': 'text/plain' });
8 + res.end('Homepage');
9 + break;
10 + case '/about':
11 + res.writeHead(200, { 'Content-Type': 'text/plain' });
12 + res.end('About');
13 + default:
14 + res.writeHead(404, { 'Content-Type': 'text/plain' });
15 + res.end('Not Found');
16 + break;
17 + }
18 +}).listen(3000);
19 +
20 +console.log('Server started on localhost:3000; press Ctrl-C to terminate....');
...\ No newline at end of file ...\ No newline at end of file
1 -exports.getWeatherData= function () { 1 +exports.getWeatherData = function () {
2 return { 2 return {
3 locations: [ 3 locations: [
4 { 4 {
...@@ -6,22 +6,23 @@ exports.getWeatherData= function () { ...@@ -6,22 +6,23 @@ exports.getWeatherData= function () {
6 forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html', 6 forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html',
7 iconUrl: 'http://icons-ak.wxug.com/i/c/k/cloudy.gif', 7 iconUrl: 'http://icons-ak.wxug.com/i/c/k/cloudy.gif',
8 weather: 'Overcast', 8 weather: 'Overcast',
9 - temp: '54.1 F(12.3C', 9 + temp: '54.1 F (12.3 C)',
10 }, 10 },
11 { 11 {
12 +
12 name: 'Bend', 13 name: 'Bend',
13 - forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html', 14 + forecastUrl: 'http://www.wunderground.com/US/OR/Bend.html',
14 iconUrl: 'http://icons-ak.wxug.com/i/c/k/partlycloudy.gif', 15 iconUrl: 'http://icons-ak.wxug.com/i/c/k/partlycloudy.gif',
15 weather: 'Partly Cloudy', 16 weather: 'Partly Cloudy',
16 - temp: '55.0 F(12.3C', 17 + temp: '55.0 F (12.8 C)',
17 }, 18 },
18 { 19 {
19 name: 'Manzanita', 20 name: 'Manzanita',
20 - forecastUrl: 'http://www.wunderground.com/US/OR/Portland.html', 21 + forecastUrl: 'http://www.wunderground.com/US/OR/Manzanita.html',
21 iconUrl: 'http://icons-ak.wxug.com/i/c/k/rain.gif', 22 iconUrl: 'http://icons-ak.wxug.com/i/c/k/rain.gif',
22 weather: 'Light Rain', 23 weather: 'Light Rain',
23 - temp: '55.0 F(12.3C', 24 + temp: '55.0 F (12.8 C)',
24 }, 25 },
25 ], 26 ],
26 }; 27 };
27 -}
...\ No newline at end of file ...\ No newline at end of file
28 +};
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -55,7 +55,7 @@ app.get('/', function (req, res) { ...@@ -55,7 +55,7 @@ app.get('/', function (req, res) {
55 tours: [ 55 tours: [
56 { name: 'Hood River', price: '$99.95' }, 56 { name: 'Hood River', price: '$99.95' },
57 { name: 'Oregon Coast', price: '$159.95' },], 57 { name: 'Oregon Coast', price: '$159.95' },],
58 - specialsUrl: '/about', 58 + specialsUrl: 'http://blog.naver.com/gjwodnr3454',
59 currencies: ['USD', 'GBP', 'BTC'], 59 currencies: ['USD', 'GBP', 'BTC'],
60 }; 60 };
61 res.render('home', { 61 res.render('home', {
...@@ -66,7 +66,13 @@ app.get('/', function (req, res) { ...@@ -66,7 +66,13 @@ app.get('/', function (req, res) {
66 currencies: product.currencies 66 currencies: product.currencies
67 }); 67 });
68 }); 68 });
69 - 69 +app.get('/about', function (req, res) {
70 + // var randomFortune = fortunes[Math.floor(Math.random() * fortunes.length)];
71 + res.render('about', {
72 + fortune: fortune.getFortune(),
73 + pageTestScript: '/qa/tests-about.js'
74 + });
75 +});
70 app.get('/tours/hood-river', function (req, res) { 76 app.get('/tours/hood-river', function (req, res) {
71 //레이아웃을 쓰지 않으려면 layout:null 넘김 77 //레이아웃을 쓰지 않으려면 layout:null 넘김
72 //null 말고 layouts 서브디렉토리에 있는 다른 레이아웃을 써도됨. 78 //null 말고 layouts 서브디렉토리에 있는 다른 레이아웃을 써도됨.
...@@ -78,12 +84,16 @@ app.get('/tours/oregon-coast', function (req, res) { ...@@ -78,12 +84,16 @@ app.get('/tours/oregon-coast', function (req, res) {
78 app.get('/tours/request-group-rate', function (req, res) { 84 app.get('/tours/request-group-rate', function (req, res) {
79 res.render('tours/request-group-rate'); 85 res.render('tours/request-group-rate');
80 }); 86 });
87 +app.get('/nursery-rhyme', function(req,res){
88 + res.render('nursery-rhyme');
89 +});
81 90
82 -app.get('/about', function (req, res) { 91 +app.get('/data/nursery-rhyme',function(req,res){
83 - // var randomFortune = fortunes[Math.floor(Math.random() * fortunes.length)]; 92 + res.json({
84 - res.render('about', { 93 + animal:'squirrel',
85 - fortune: fortune.getFortune(), 94 + bodyPart:'tail',
86 - pageTestScript: '/qa/tests-about.js' 95 + adjective:'bushy',
96 + noun:'heck',
87 }); 97 });
88 }); 98 });
89 99
......
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 @@ ...@@ -18,8 +18,8 @@
18 </ul> 18 </ul>
19 {{! if의 반대래, unless는...}} 19 {{! if의 반대래, unless는...}}
20 {{#unless currencies}} 20 {{#unless currencies}}
21 -<p>All prices in {{currency.name}}.</p> 21 +<p>All prices in {{currency.name}}.</p>`
22 {{/unless}} 22 {{/unless}}
23 {{#if specialsUrl}} 23 {{#if specialsUrl}}
24 -<p>Check out our special at <a href="{{specialsUrl}}">{{specialsUrl}}!</a></p> 24 +<p>You can also check my personal <a href="{{specialsUrl}}">Blog(Korean)</a></p>
25 {{/if}} 25 {{/if}}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,12 +2,23 @@ ...@@ -2,12 +2,23 @@
2 <html> 2 <html>
3 3
4 <head> 4 <head>
5 - <title>Meadowlark Travel</title> 5 +{{! alt -> 사진이 뜨지 않았을때 대체할만한 설명!!}}
6 - {{{_sections.head}}} 6 +{{! CSS style을 이용해서 가운데 정렬}}
7 - {{#if showTests}} 7 +<style>
8 - <link rel="stylesheet" href="/vendor/mocha.css"> {{/if}} 8 + img
9 - <script src="//code.jquery.com/jquery-2.0.2.min.js"></script> 9 + {
10 + display:block;
11 + margin-left:auto;
12 + margin-right:auto;
13 + }
14 +</style>
15 +<a href="/"><img src="/img/logo.png" alt="my logo"></a>
16 +
10 17
18 + {{#if showTests}}
19 + <link rel="stylesheet" href="/vendor/mocha.css">
20 + {{/if}}
21 + {{{_sections.head}}}
11 <style> 22 <style>
12 ul { 23 ul {
13 list-style-type: none; 24 list-style-type: none;
...@@ -16,6 +27,7 @@ ...@@ -16,6 +27,7 @@
16 overflow: hidden; 27 overflow: hidden;
17 background-color: #333; 28 background-color: #333;
18 } 29 }
30 +
19 li { 31 li {
20 float: left; 32 float: left;
21 } 33 }
...@@ -32,7 +44,6 @@ ...@@ -32,7 +44,6 @@
32 background-color: #111; 44 background-color: #111;
33 } 45 }
34 </style> 46 </style>
35 -
36 <ul> 47 <ul>
37 <li> 48 <li>
38 <a class="active" href="/">Home</a> 49 <a class="active" href="/">Home</a>
...@@ -41,7 +52,7 @@ ...@@ -41,7 +52,7 @@
41 <a href="/about">About</a> 52 <a href="/about">About</a>
42 </li> 53 </li>
43 <li> 54 <li>
44 - <a href="/tours/hood-river">Hood River</a> 55 + <a href="https://www.youtube.com/channel/UCsc9IDPcx0VNbIM07-hu9aw">WhiteDog Youtube</a>
45 </li> 56 </li>
46 <li> 57 <li>
47 <a href="/tours/oregon-coast">Oregon Coast</a> 58 <a href="/tours/oregon-coast">Oregon Coast</a>
...@@ -51,12 +62,11 @@ ...@@ -51,12 +62,11 @@
51 </head> 62 </head>
52 63
53 <body> 64 <body>
54 - <header> 65 + {{{body}}}
55 - <img src="/img/logo2.png" alt="Meadowlark Travel Logo">
56 - </header>
57 - {{{body}}} {{#if showTests}}
58 <script src="http://code.jquery.com/jquery-2.0.2.min.js"></script> 66 <script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
59 - {{{_sections.jquery}}} 67 +
68 + {{#if showTests}}
69 +
60 <div id="mocha"></div> 70 <div id="mocha"></div>
61 <script src="/vendor/mocha.js"></script> 71 <script src="/vendor/mocha.js"></script>
62 <script src="/vendor/chai.js"></script> 72 <script src="/vendor/chai.js"></script>
...@@ -64,9 +74,14 @@ ...@@ -64,9 +74,14 @@
64 mocha.ui('tdd'); 74 mocha.ui('tdd');
65 var assert = chai.assert; 75 var assert = chai.assert;
66 </script> 76 </script>
67 - <script src="/qa/tests-global.js"></script> {{#if pageTestScript}} 77 + <script src="/qa/tests-global.js"></script>
68 - <script src="{{pageTestScript}}"></script> {{/if}} 78 +
69 - <script>mocha.run();</script> {{/if}} 79 + {{#if pageTestScript}}
80 + <script src="{{pageTestScript}}"></script>
81 + {{/if}}
82 +
83 + <script>mocha.run();</script>
84 + {{/if}}
70 </body> 85 </body>
71 86
72 </html> 87 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 {{#section 'head'}} 1 {{#section 'head'}}
2 <script src="//cdnjs.cloudflare.com/ajax.libs/handlebars.js/1.3.0/handlebars.min.js"></script> 2 <script src="//cdnjs.cloudflare.com/ajax.libs/handlebars.js/1.3.0/handlebars.min.js"></script>
3 -<script id="nurseryRhymeTemplate" type="text.x-handlebars-template"> 3 +<script id="nurseryRhymeTemplate" type="text/x-handlebars-template">
4 Marry had a little <b>\{{animal}}</b>, its <b>\{{bodyPart}}</b> 4 Marry had a little <b>\{{animal}}</b>, its <b>\{{bodyPart}}</b>
5 was <b>\{{adjective}}</b> as <b>\{{noun}}</b>. 5 was <b>\{{adjective}}</b> as <b>\{{noun}}</b>.
6 </script> 6 </script>
7 {{/section}} 7 {{/section}}
8 +
9 +{{! div는 특별한 의미가 있는건 아니고 그냥 가상의 레이아웃을 나누는 태그라고함}}
10 +<div id="nurseryRhyme">Click a button....</div>
11 +<hr>{{! 문단선을 의미! ㅋㅋ 태그 검색하면서 하니 쉽네}}
12 +<button id="btnNurseryRhyme">Generate nursery rhyme</button>
13 +<button id="btnNurseryRhymeAjax">Generate nursery rhyme from AJAX</button>
14 +
15 +{{#section 'jquery'}}
16 +<script>
17 + $(document).ready(function () {
18 + var nurseryRhymeTemplate = Handlebars.compile(
19 + $('#nurseryRhymeTemplate').html());
20 +
21 + var $nurseryRhyme = $('#nurseryRhyme');
22 +
23 + $('#btnNurseryRhyme').on('click', function (evt) {
24 + evt.preventDefault();
25 + $nurseryRhyme.html(nurseryRhymeTemplate({
26 + animal: 'basilisk',
27 + bodyPart: 'tail',
28 + adjective: 'sharp',
29 + noun: 'a needle'
30 + }));
31 + });
32 +
33 +
34 + $('btnNurseryRhymeAjax').on('click', function (evt) {
35 + evt.preventDefault();
36 + $.ajax('/data/nursery-rhyme', {
37 + success: function (data) {
38 + $nurseryRhyme.html(nurseryRhymeTemplate(data))
39 + }
40 + });
41 + });
42 + });
43 +</script>
44 + {{/section}}
...\ No newline at end of file ...\ No newline at end of file
......