filipenatanael / laravel-graphql

Laravel 5 API Using Facebook GraphQL | Consuming with FrontEnd using VueJS & Apollo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel API Using GraphQL

Travis Build Status License Laravel Community

alt text

GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data.

Laravel is a web application framework PHP with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling.

Running

ServerSide (Laravel & GraphQL)
cd laravel-graphql
php artisan serve
# http://localhost:8000/graphiql
ClientSide (Vue.js & Apollo)
cd laravel-graphql/client-application
npm run serve
# http://localhost:8081

UserQuery:

{
  user(id: 2) {
    name
    email
    posts {
      title
      description
      comments {
        content
        created_at
      }
    }
  }
}

Mutations:

mutation {
  createUser(
    name: "Filipe Natanael",
    email: "filipenatanael@example.com",
    password: "MyPassWord#123"
  ) {
    id
    email
  }
}

mutation {
  createPost(
    user_id: 2,
    title: "JavaScript TDD",
    description: "JavaScript TDD Course....."
  ) {
    id
  }
}

About

Laravel 5 API Using Facebook GraphQL | Consuming with FrontEnd using VueJS & Apollo


Languages

Language:PHP 94.9%Language:HTML 3.5%Language:Vue 1.6%