Git Product home page Git Product logo

json-server-template's Introduction

JSON Server Template

Setup

Before opening the Frontend server, you must fork and clone this repository first and open the JSON server.

git clone [email protected]:kyuhee1011/json-server-template.git
cd db

Then install the dependencies by running:

npm install

Then open the JSON server by running:

json-server --watch db.json

Seeding Data

To set up your database, update the db/seeds.json file to contain an object with a key pointing to an array of data, like this:

{
  "desserts": [
    {
      "id": 1,
      "name": "Dalgona (Korean sugar candy)",
      "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Dalgona.jpg/220px-Dalgona.jpg",
      "description": "Sweet Sugar Candy with fun shape",
      "favorite": false
    },
    {
      "id": 2,
      "name": "Korean Fish Shaped Bread (Bungeoppang)",
      "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Boong_o_bbang.jpg/220px-Boong_o_bbang.jpg",
      "description": "Bungeoppang is a fish-shaped bread with sweetened red bean filling.",
      "favorite": true
    }
  ]
}

Then, run npm run seed to copy data from the db/seeds.json file to the db/db.json file. json-server uses the db.json file to create your RESTful API, so make sure your db.json file is always up to date!

Any time you want to reset your database back to your original data, run npm run seed again. Doing this will overwrite all the data in your db.json file, so make sure you don't have any data in that file that you don't mind losing!

Making Updates

Whenever you made a change, please update your GitHub Repository by running the code below.

git add .
git commit -m "Updated database"
git push

Frontend code GitHub Repository

https://github.com/kyuhee1011/kyuhee-react-project

json-server-template's People

Contributors

kyuhee1011 avatar ihollander avatar lizbur10 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.