GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CamiloQuezadaDev/graphql-ruby-blog: GraphQL Ruby Blog example for me ✌️👨🏻‍💻

BranchesTags
Open more actions menu

Latest commit

 

History

65 Commits
65 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
bin
bin
 
 
config
config
 
 
db
db
 
 
lib/tasks
lib/tasks
 
 
log
log
 
 
public
public
 
 
test
test
 
 
tmp
tmp
 
 
vendor
vendor
 
 
.gitignore
.gitignore
 
 
.ruby-version
.ruby-version
 
 
Gemfile
Gemfile
 
 
Gemfile.lock
Gemfile.lock
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
config.ru
config.ru
 
 

Repository files navigation

graphql-ruby Graphql Ruby Blog

 

Table of contents:

  • Proyect features
  • Proyect Installation
  • Interesting Files
    • Root files
    • Record types
    • Mutations
    • Sample GraphQL Queries
  • Inspiration

 

This Proyect has the following features:

  • authentication system
  • users can create, read, update and delete blogs
  • users can comment the blog of other user
  • users can clap the blog of other user
  • users can save the blog of other user to favorites

 

Installation

Install dependencies:

bundle install

rails db:setup

Starting the server:

rails server

Opening the application:

open http://localhost:3000/

or

http://localhost:3000/graphiql

 

Interesting Files:

Root files

  • GraphqlController - GraphQL controller (api entry point)
  • GraphqlTutorialSchema - the schema definition
  • Mutations - root mutations
  • Queries - root queries

Record types

  • UserType - record type
  • PostType - record type

Mutations

  • SignIn - mutation

  • SignUp - mutation

  • CreatePost - mutation

  • UpdatePost - mutation

  • DeletePost - mutation

  • AddComment - mutation

  • AddClap - mutation

  • AddFavorite - mutation

  • DeleteFavorite - mutation

 

Sample GraphQL Queries

Sign Up:

mutation {
  signUp(input: { name: "Leonardo da Vinci", credentials: { email: "[email protected]", password: "leonardo123" } } ) {
    user {
      id 
      email 
      name
    }
    success
    errors
  }
}

Create new user token:

mutation {
  signIn(input: { credentials: { email: "[email protected]", password: "leonardo123" } }) {
    user {
      id 
      email 
      name
    }
  success
  token
  errors
  }
}

Create post:

mutation {
  createPost(input: { title:"How to create a GraphQL Blog with Rails", body:"Vitae eaque dolor. Et amet laudantium. Molestiae velit quos." }) {
    post {
      id
      title
      content
      postedAt
      updatedAt 
      postedBy {
        name
      }
    }
  success
  errors
  }
}

Update post:

mutation {
  updatePost(input: { id:"1", title:"How to create a React App", body:"Vitae eaque dolor. Et amet laudantium. Molestiae velit quos."}) {
    post {
      id
      title
      content
      postedAt
      updatedAt 
      postedBy {
        name
      }
    }
  updated
  errors
  }
}

Destroy post:

mutation {
  destroyPost(input: { id:"1"}) {
    post {
      id
      title
      content
      postedAt
      updatedAt 
      postedBy {
        name
      }
    }
  deleted
  errors
  }
}

Add Comment:

mutation {
  addComment(input: { postId:"1", content:"I love your Post"} ) {
  comment {
    id 
    content
    commentedBy {
      id
      name
    }
  }
    errors
    success
  }
}

Add Clap

mutation {
  addClap(input: {postId:"3"}){
    clap {
      clappedBy {
        name
      }
    }
    success
    errors
  }
}

Add Favorite

mutation {
  addFavorite(input: {postId:"3"}){
    favorite {
      title
    }
    success
    errors
  }
}

Delete Favorite

mutation {
  deleteFavorite(input: {postId:"3"}){
    favorite {
      title
    }
    errors
    deleted
  }
}

 

Inspiration

This sample app is based on graphql-ruby tutorial from howtographql

 

Lookin' at the source code huh? Be sure to drop me a line! I'd love to chat, whether it's about code, design, sports, coffee, books, or anything in between. 👨🏻‍💻☕️

About

GraphQL Ruby Blog example for me ✌️👨🏻‍💻

Topics

graphqlgraphql-apirailsrails-apirubyruby-on-rails

Resources

Readme
MIT license
Activity

Stars

8 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.