var http =require('http');
var jade= require('jade');
var fs=require('fs');
http.createServer(function(request , response){
fs.readFile('jadepage3.jade','utf8', function(error,data){
var fn=jade.compile(data);
response.writeHead(200,{'Content-Type':'text/html'});
response.end(fn({
name:'rintlantta',
description:'hello ejs with node js'
}));
});
}).listen(52775 , function(){
console.log('server runnig at http://127.0.0.1:52775');
});
jade 파일
doctype html
html
head
title index page
body
//jade string
h1 #{name}...!
h2= description
hr
- for(var i=0; i< 10 ; i++){
p
a(href="http://hand.co.kr") go to hanbit media #{i}
- }
'Node js' 카테고리의 다른 글
express param 예제 (0) | 2015.03.30 |
---|---|
nodejs express 모듈 출력 예제 (0) | 2015.03.30 |
npm install (0) | 2015.03.25 |
node js url로 페이지 이동구분 주기 (0) | 2015.03.25 |
node js 이미지를 서비스하는경우 (0) | 2015.03.25 |