[맥os] httpie 설치와 사용방법
본문 바로가기

Backend/node.js

[맥os] httpie 설치와 사용방법

https://httpie.io/docs#examples

 

HTTPie 2.4.0 (latest) documentation

CLI HTTP that will make you smile. JSON and sessions support, syntax highlighting, wget-like downloads, plugins, and more.

httpie.io

 

위 문서를 참고하여 httpie를 설치한다.

brew install httpie

 

나의경우는 http가 정상작동되는지 확인하기위해 httpie를 사용해보려한다.

 

server.js

const http = require('http')

const server = http.createServer((req, res) => {
  res.statusCode = 200
  res.end('hi')
})

const PORT = 4000

server.listen(PORT, () => {
  console.log(`the server is listening at port: ${PORT}`)
})

 

서버를 켠다음(터미널에 node server.js)

http localhost:포트번호

 

정상작동되면 200이고 성공메시지인 hi가 출력된다.

 

실제 웹브라우저에서도 정상작동

이밖에 postman이라는 테스터도있고 직접 터미널창에 하는 방법도있다.

반응형