https://httpie.io/docs#examples
위 문서를 참고하여 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이라는 테스터도있고 직접 터미널창에 하는 방법도있다.
반응형
'Backend > node.js' 카테고리의 다른 글
[nodejs] 간단한 restfulAPI 서버만들기3 - 코드개선(추상화), 리펙토링 (0) | 2021.09.01 |
---|---|
[nodejs] 간단한 restfulAPI 서버만들기2 (0) | 2021.08.30 |
[nodejs] 간단한 restfulAPI 서버만들기 (0) | 2021.08.27 |
nodemon 노드몬 설치 사용방법 (0) | 2021.08.03 |
Node version management 버전 업그레이드 쉬운방법 (0) | 2021.07.30 |