Skip to content

Latest commit

 

History

History
98 lines (61 loc) · 1.58 KB

README.md

File metadata and controls

98 lines (61 loc) · 1.58 KB

JSON-SERVER

  1. Clona il progetto
  • Eseguire il codice
npm run start
  • Eseguire il codice in development con nodemon
npm run dev
  • Compilare .exe
npm run build




Esempi di cURL

NO TOKEN

  • GET
curl -X GET -H "Content-Type: application/json" http://localhost:3000/liste/
  • PATCH
curl -X PATCH -H "Content-Type: application/json" -d "{\"nome\": \"sia\", \"data\": \"01-07-2023\" }" http://localhost:3000/liste/1
  • POST
curl -X POST -H "Content-Type: application/json" -d "{\"nome\": \"sia\", \"data\": \"01-07-2023\" }" http://localhost:3000/liste/
  • DELETE
curl -X DELETE -H "Content-Type: application/json" http://localhost:3000/liste/



CON TOKEN

  • GET
curl -X GET -H "Authorization: Bearer IL_TUO_JWT" http://localhost:3000/liste/
  • PATCH
curl -X PATCH -H "Authorization: Bearer IL_TUO_JWT" -d "{\"nome\": \"sia\", \"data\": \"01-07-2023\" }" http://localhost:3000/liste/1
  • POST
curl -X POST -H "Authorization: Bearer IL_TUO_JWT" -d "{\"nome\": \"sia\", \"data\": \"01-07-2023\" }" http://localhost:3000/liste/
  • DELETE
curl -X DELETE -H "Authorization: Bearer IL_TUO_JWT" http://localhost:3000/liste/1




Configurazione docker

  • Esegui il codice di seguito per creare un bridge interno a docker
docker network create -d bridge --subnet=172.21.0.0/16 --gateway=172.21.0.1 json_server_bridge
  • Scarica il file docker-compose.yml ed esegui questo codice nel terminale
docker-compose up -d