var fs=require('fs');


var http=require('http');


http.createServer(function(request , response){

fs.readFile('beacon.png',function(error  , data){

response.writeHead(200,{'Content-Type':'image/png'})

response.end(data);

});

}).listen(52275,function(){

console.log('server running at http://127.0.0.1:52275');

});



음악을 서비스하는경우  content -type 부분의 image/를  'audio/mp3'로 바꿔주면 된다 

'Node js' 카테고리의 다른 글

nodejs jade파일에 데이타 전달 예제  (0) 2015.03.26
npm install  (0) 2015.03.25
node js url로 페이지 이동구분 주기  (0) 2015.03.25
노드 js html 서비스  (0) 2015.03.25
웹서비스 기본 예제  (0) 2015.03.24
Posted by 이상욱1
,