Skip to content

Instantly share code, notes, and snippets.

@mamadaliev
Created February 29, 2024 10:18
Show Gist options
  • Save mamadaliev/921809342be3f8dd355e03794d30832c to your computer and use it in GitHub Desktop.
Save mamadaliev/921809342be3f8dd355e03794d30832c to your computer and use it in GitHub Desktop.
React + Mock Server example.

Mock Server

To create mock server, install json-server:

npm install -g json-server

Add existing items with your structure:

{
  "tickets": [
    {
      "id": 1,
      "name": "Проблема с доступом к интернету",
      "description": "Не могу подключиться к Wi-Fi.",
      "status": "OPEN"
    },
    {
      "id": 2,
      "name": "Проблема с принтером",
      "description": "Принтер не печатает.",
      "status": "IN_PROGRESS"
    },
    {
      "id": 3,
      "name": "Проблема с почтовым клиентом",
      "description": "Не получаю электронные письма.",
      "status": "CLOSED"
    }
  ]
}

Run json server pointing your json file with items:

json-server --watch db.json --port 3001

React App

npm run start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment