jiwoolee.space
Vuejs ctx methods (ctx.params, ctx.reqeust.body, ctx.response.status, ...) 본문
Frontend-Vuejs
Vuejs ctx methods (ctx.params, ctx.reqeust.body, ctx.response.status, ...)
jiwoolee 2021. 8. 5. 15:49ctx.params / ctx.reqeust.body / ctx.response.status / ...
ctx 관련하여 http ctx 메소드 확인
ctx.params
ctx.params
// URL params, :name
ctx.request.body
ctx.request.body
// POST params
ctx.query
ctx.query
//ctx.request.query 대신 ctx.query로 가능 - koa
// URL params, ?name=jw
ctx.response.status
ctx.response.status
//숫자 코드로 응답 상태 설정
숫자별 상태 의미
더보기
- 100 "continue"
- 101 "switching protocols"
- 102 "processing"
- 200 "ok"
- 201 "created"
- 202 "accepted"
- 203 "non-authoritative information"
- 204 "no content"
- 205 "reset content"
- 206 "partial content"
- 207 "multi-status"
- 208 "already reported"
- 226 "im used"
- 300 "multiple choices"
- 301 "moved permanently"
- 302 "found"
- 303 "see other"
- 304 "not modified"
- 305 "use proxy"
- 307 "temporary redirect"
- 308 "permanent redirect"
- 400 "bad request"
- 401 "unauthorized"
- 402 "payment required"
- 403 "forbidden"
- 404 "not found"
- 405 "method not allowed"
- 406 "not acceptable"
- 407 "proxy authentication required"
- 408 "request timeout"
- 409 "conflict"
- 410 "gone"
- 411 "length required"
- 412 "precondition failed"
- 413 "payload too large"
- 414 "uri too long"
- 415 "unsupported media type"
- 416 "range not satisfiable"
- 417 "expectation failed"
- 418 "I'm a teapot"
- 422 "unprocessable entity"
- 423 "locked"
- 424 "failed dependency"
- 426 "upgrade required"
- 428 "precondition required"
- 429 "too many requests"
- 431 "request header fields too large"
- 500 "internal server error"
- 501 "not implemented"
- 502 "bad gateway"
- 503 "service unavailable"
- 504 "gateway timeout"
- 505 "http version not supported"
- 506 "variant also negotiates"
- 507 "insufficient storage"
- 508 "loop detected"
- 510 "not extended"
- 511 "network authentication required"
ctx.request.header
ctx.request.header: Set request header object.
ctx.request.method
ctx.request.method: Set request method, useful for implementing middleware
**
미들웨어:
route를 변경할때 걸러주었으면 하는 역할, 예외처리를 해야하는 것, 페이지 접속시마다 특정 기능이 실행되었으면 하는 기능을 모두 처리
ctx.request.path
ctx.request.path: Set request pathname and retain query-string when present.
더 다양한 http ctx 메소드
https://runebook.dev/en/docs/koa/api/request.md
Koa - Request - A Koa Request object is an abstraction on top of node's vanilla request object,
Request A Koa Request object is an abstraction on top of node's vanilla request object, providing additional functionality that is useful for every day HTTP server development. API Request header object. This is the same as the headers field on node's http
runebook.dev
'Frontend-Vuejs' 카테고리의 다른 글
Vuejs 개념 정리02 computed와 watch (0) | 2021.08.18 |
---|---|
Vuejs 개념 정리01 템플릿 문법(보간법, 디렉티브, 약어) (0) | 2021.08.17 |
Vuejs post와 get 차이 - axios 서버 통신 (0) | 2021.08.05 |
Vuejs v-model이 무엇일까 (0) | 2021.08.04 |
Vuex helpers - parent,child와 actions,mapActions (0) | 2021.08.04 |