본문 바로가기

Study

서버란

1. http로 요청

 

2. node js 환경에서 구현 -> express환경에서 응답받기

3. curl 을 통해서 데몬에게 요청을 보낼 것

 

 

.\ingcoin-cli.exe -conf="C:\Users\pc-sdf\coin2\bin\incoind2.conf" getnewaddress ingoo4

 

curl은 윈도우가 아닌 리눅스(쉘)에서 

 

#curl

 

-H : header

-d : data

-X : Request method

 

curl [option] [domain]

 

[domain] = RPCUSER:RCPPSDDEOTF@IPSFFTRDD:RPCPORT

 

curl -X POST -H "" -d "[data]" [domain]

 

RPCUSER = ingoo

RPCPASSWORD = 1234

IPACCRESS = 127.0.0.1

RPCPORT = 3000



incoind2.conf

server=1

rpcport=3000

 

[domain] = ingoo:1234@127.0.0.1:3000

 

[data] = {"method":"getnewaddress","params":["ingoo5"]}

 

curl -X POST -H "Content-type: application/json" -d '{"method":"getnewaddress","params":["ingoo5"]}' ingoo:1234@127.0.0.1:3000

 

.\ingcoin-cli.exe -conf="C:\Users\KGA_10\coin2\bin\incoind2.conf" getnewaddress ingoo4



1. sever.js 만들기

2. npm init 해서 node js 환경 구축

3. npm install express

4. npm install request



express 역할 => http 통신 방식으로 요청이 들어오면 응답을 주는

web server (express)에서 데몬 서버로 요청을 보낼때 request 메서드를 사용하게 된다.

'Study' 카테고리의 다른 글

lerna 프로젝트 사용  (0) 2021.12.29
12.29 에러모음  (0) 2021.12.29
window node-sass 에러  (0) 2021.12.28
window wsl 설치  (0) 2021.12.28
docker로 mongodb 연결하기  (1) 2021.11.30