[React] json 서버 사용법

json server 사용법

 

(01_react_200에서 통합 터미널 열고) npx create-react-app 008 (008폴더 만들기)

cd 008

npm start

 

01_axios 파일 생성 (008파일 다 넣기)

02_json 파일 다운로드 (가짜 백엔드서버)

파일로 압축 파일 풀기

008 파일에 axios 설치

(01_axios에서 통합 터미널 열고) npm install axios

설치 확인 : package.json / dependencies 안에 axios 확인

index.html에 

bootstrap css cdn 넣기

<!-- bootstrap css cdn -->
    <link
      rel="stylesheet"
      integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
      crossorigin="anonymous"
    />

02_json_server에 jsonserver 설치 ( -g 글로벌 설치 : 1번만 설치하면 됨 )

(02_json_server에서 통합 터미널 열고) npm i -g json-server

(01_axios에서 통합 터미널 열고) npm start

(02_json_server에서 통합 터미널 열고) npm start (주소창 직접 검색해야함 http://localhost:8000)

ctrt + c = 서버 종료 단축키   일괄 작업을 끝내시겠습니까? y/n

ctrl + r 텍스트바꾸기

 

anxios 설치
npm install anxios

jsonserver 설치
npm i -g json-server
npm start

ctrt + c 일괄 작업을 끝내시겠습니까? y/n
주소창 직접 검색해야함