Skip to content

Node.js 에서 http client 를 구현 했습니다.

Notifications You must be signed in to change notification settings

KSH-code/HttpClient-Nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

사용 방법

options 변수를 수정해 홈페이지 주소와 포트를 설정한다.

get(options, '/ip', function(res){
    var serverData = '';
    res.on('data', function (chunk) {
        serverData += chunk;
    });
    res.on('end', function () {
        console.log(serverData.toString('utf-8'));
    });
});

post(options, '/post', function(res){
    res.on('data', function (chunk) {
        console.log(chunk.toString('utf-8')); // 받은 데이터
    });
},
{ // post할 객체
    foo: 'bar'
});

del_(options, '/del', function(res){
    res.on('data', function (chunk) {
        console.log(chunk.toString('utf-8')); // 받은 데이터
    });
},
{ // delete할 객체
    foo: 'bar'
});

이렇게 사용하면 된다.

About

Node.js 에서 http client 를 구현 했습니다.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published