티스토리 뷰

typicode/json-server

 

typicode/json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously) - typicode/json-server

github.com

  • Get a full fake REST API with zero coding in less than 30 seconds (seriously)
  • Created with <3 for front-end developers who need a quick back-end for prototyping and mocking
  • reseponse 값을 json 데이터로 정의 후 간단한게 mock api 테스트를 해볼 수 있는 오픈소스
  • package.json > scripts 에 추가
"jsonServer": "json-server --watch db.json --port 9000 --routes routes.json"
  • db.json
    • api response 값 정의
  • routes.json
    • jsonServer 에서 uri depth 로는 호출이 불가능하여 routes 설정이 필요
    • url 에서 파라미터가 있는 경우 * 처리 또는 파라미터 매핑도 가능 (처리가 안된경우 호출 불가능)
    /api/posts # → /posts
    /api/posts/1  # → /posts/1
    /posts/1/show # → /posts/1
    /posts/javascript # → /posts?category=javascript
    /articles?id=1 # → /posts/1​
    {
      "/batch/event/history/list*": "/batchEventHistoryList",
      "/employee/list*": "/employeeList"
    	"/test?name=:name&employeeId=:employeeId": "/test/name
    }​

'Programming > Open Source' 카테고리의 다른 글

[Kafka] Offset  (0) 2021.05.15
[Kafka] Partition 추가 시 고려사항  (0) 2021.05.15
[Kafka] Kafka 구성 시 하드웨어 사양 참고  (0) 2021.05.15
[Kafka] Kafka 성능테스트  (0) 2021.05.15
JavaScript checkbox 선택 확인  (5) 2017.04.18
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함