Apollo - a MeteorJS evolution

Small overview and comparison with MeteorJS

Pavel Shalaev (@lawrentiy)

june 2017

Apollo

http://dev.apollodata.com

MeteorJS

http://meteor.com

Since 2011

Common code for client and server

Any UI (Blase, React, Angular, Vue, ...)

Optimistic UI

Reactivity

MongoDB (preferable)

Build tool

MDG

developers grade

Since 2016

GraphQL

apollo-client (binding for any UI)

apollo-server (express, koa, hapi, ...)

More modular

Reactivity

Any DB

MDG

GraphQL

GraphQL - язык или синтаксис (кому как удобнее).

Позволяет клиенту точно указать, какие данные ему нужны.
Облегчает агрегацию данных из нескольких источников.
Использует систему типов для описания данных.


Построен на трёх основных строительных блоках:

схемa (schema),

запросах (queries)

решателях (resolvers).


Поддерживают вложенные поля.

Cхема запроса GraphQL и структура базы данных никак не связаны

https://habrahabr.ru/post/326986/

query getMyPost($id: String) {
  post(id: $id){
    title
    body
    author{
      name
      avatarUrl
      profileUrl
    }
  }
}
Query: {
  post(root, args) {
    return Posts.find({ id: args.id });
  }
},
Post: {
  author(post) {
    return Users.find({ id: post.authorId})
  }
}
const typeDefs = `
  type Author {
    id: Int!
    firstName: String
    lastName: String
    posts: [Post] # the list of Posts by this author
  }
  type Post {
    id: Int!
    title: String
    author: Author
    votes: Int
  }
  # the schema allows the following query:
  type Query {
    posts: [Post]
    author(id: Int!): Author
  }
  # this schema allows the following mutation:
  type Mutation {
    upvotePost (
      postId: Int!
    ): Post
  }
`;

Query

Resolvers

Schema

https://github.com/apollographql/apollo

const FeedQuery = gql`query allPosts {
  allPosts(orderBy: createdAt_DESC) {
    id
    imageUrl
    description
  }
}`

const ListPageWithData = graphql(FeedQuery)(ListPage)
{this.props.data.allPosts.map(post => (
  <Post
    key={post.id}
    post={post}
    refresh={() => this.props.data.refetch()}
  />
))}

https://github.com/apollographql/apollo

https://github.com/apollographql/apollo

Learn:

learnapollo.com

 

Short list of tools and services:

apollodata.com

github: apollographql/launchpad

launchpad.graphql.com

www.graph.cool

optics.apollodata.com

Screw Apollo you guys im going home

Apollo a MeteoJS evolution

By lawrentiy

Apollo a MeteoJS evolution

Apollo was just released. And MDG, the development team of Apollo, done it with expirience of MeteorJS in mind. Is it true, that Apollo is the next stage of Meteor? We will try to undertand it.

  • 1,048