GithubHelp home page GithubHelp logo

thomasdgny / graphql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.2 MB

This is a local GraphQL server with mock data for "users" and "blogs" and CRUD functionality, ideal for GraphQL development and query experimentation in Apollo Client.

JavaScript 100.00%

graphql's Introduction

Local GraphQL Server with Mock Data

This project is a local GraphQL server that provides a set of mock data and CRUD (Create, Read, Update, Delete) functionality for two tables: "users" and "blogs." It's designed to help you get started with GraphQL development and allows you to experiment with queries in Apollo Client.

Prerequisites

Before you get started with this project, ensure that you have the following prerequisites:

  • Node.js: Make sure you have Node.js installed on your system.

Getting Started

  1. Clone the repository to your local machine:
  git clone https://github.com/GoodGuyForReal/graphql.git
  1. Install project dependencies:
  npm install
  1. Start the GraphQL server:
npm start
  1. Open a web browser and navigate to http://localhost:4000 to access the GraphQL Playground.

Project Structure

The project has the following directory structure:

  • /actions: Resolver functions
  • /queries.js: Some ready to use queries for apollo client
  • db.js: Mock data.
  • schema.js: GraphQL schema definitions.
  • resolvers.js/: Resolver functions imported from action folder for handling queries and mutations.
  • index.js: The main entry point for the GraphQL server.
  • package.json: Node.js project configuration.

Available Queries and Mutations

Available Queries and Mutations

Queries:

  • users: [User] === Retrieve a list of all users.
  • user(id: ID!): User === Retrieve a specific user by their ID.
  • blogs: [Blog] === Retrieve a list of all blogs.
  • blog( id: ID! ): Blog === Retrieve a specific blog by its ID.

Mutations:

  • addUser(user: AddUserInput!): User === Create a new user.
  • addBlog(blog: AddBlogInput!): Blog === Create a new blog.
  • deleteUser(id: ID!): [User] === Delete a user by ID.
  • deleteBlog(id: ID!): [Blog] === Delete a blog by ID.
  • updateUser(id: ID!, update: UpdateUserInput!): User === Update an existing user.
  • updateBlog(id: ID!, update: UpdateBlogInput!): Blog === Update an existing blog.

License

This repo is cretaed under the MIT License.

graphql's People

Contributors

thomasdgny avatar

Watchers

 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.