js 파일
var http =require('http');
var fs = require('fs');
var ejs= require('ejs');
http.createServer(function(request , response){
fs.readFile('ejspage.ejs','utf8', function(error , data){
response.writeHead(200, {'Content-Type': 'text/html'});
response.end(ejs.render(data));
});
}).listen(52735 , function(){
console.log('server runnig at http://127.0.01:52735');
});
ejs 파일
<% var name= 'Rintiantta';%>
<h1><%=name %> </h1>
<p> <%= 52 *273 %> </p>
<hr/>
<% for(var i =0; i< 10 ; i++){ %>
<h2> the square of <%= i%> is <%=i* i%> </h2>
<%} %>