style태그는 자꾸 에러가;;
jade 특수기호
-Code 자바스크립트 코드 입력
#{Value} 데이터를 출력
= Value 데이터를 출력
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
var jade = require('jade');
var http = require('http');
var fs = require('fs');
http.createServer(function (request, response) {
fs.readFile('jadePage.jade', 'utf8', function (error, data) {
var fn = jade.compile(data);
response.writeHead(200, { 'Content-Type': 'text/html' });
response.end(fn({
name : 'RintIanTta',
description: 'Hello ejs With Node.js..!'
}));
});
}).listen(5000, function () {
console.log('Server Running...');
});
| cs |
| cs |
name과 description을 jade페이지에 보낸다.
|
|
1
2
3
4
5
6
7
8
9
10
11
12
|
html
head
title Index Page
body
h1 #{name}...!
h2= dexcription
hr
- for(var i = 0 ; i<10 ; i++){
p
a(href="http://hanb.co,kr") Go To Hanbit Media #{i}
-}
| cs |
| cs |
클라이언트 측 코드
name 속성과 dexcription속성을 출력하고 반복문을 사용하여 태그가 동적으로 생성되는 것을 확인할 수 있다.
댓글
댓글 쓰기