Skylar-Lorena / tasklist-2.0

Simple task list to demonstrate CRUD actions, props, components and state in React.
https://tasklist-2-0.vercel.app/
0 stars 2 forks source link

Setup JSON Server #10

Open festus-sulumeti opened 2 months ago

festus-sulumeti commented 2 months ago

This issue involves setting up JSON Server with a db.json file to serve as a mock backend for tasks, users, and notifications. The following tasks need to be completed:

  1. Install JSON Server:

    • Add JSON Server as a development dependency to the project.
    • Ensure that the latest stable version is installed.
  2. Create db.json file:

    • Create a db.json file in the root directory of the project.
    • Define the initial data structure for tasks, users, and notifications in JSON format.
    • The data structure should include necessary properties for each entity.
  3. Configure JSON Server:

    • Create a new file named server.js in the root directory.
    • Import the required modules (e.g., json-server, path).
    • Set the path to the db.json file using path.join().
    • Create the JSON Server instance and configure the routes.
    • Start the server on a specific port (e.g., 3001).
  4. Add scripts to package.json:

    • Add a new script to package.json to start the JSON Server.
    • The script should run the server.js file using node.
    • Example: "start:server": "node server.js"
  5. Test the setup:

    • Run the JSON Server using the script added in the previous step.
    • Verify that the server is running on the specified port (e.g., http://localhost:3001).
    • Test the API endpoints for tasks, users, and notifications using tools like Postman or cURL.

Acceptance Criteria

Additional Notes