Giter Club home page Giter Club logo

apollo-graphql-express-boilerplate's Introduction

Coverage Status Build Status

apollo-graphql-express-boilerplate

A GraphQL with Apollo, Express and PostgreSQL boilerplate project.

Features

  • Apollo-server
    • Queries, Mutations, Subscriptions, Error Handling, Playground, Custom Scalars, Authentication, Integration Testing, Schema directives
  • Authentication
    • powered by JWT
    • Sign Up, Sign In
  • PostgreSQL Database with Sequelize
    • entities: Users & Posts
  • Authorization
    • protected resolvers
  • Testing

Stack

  • Node.js
  • Express
  • PostgreSQL
  • Sequelize
  • apollo-server-express
  • JWT authentication
  • Jest
  • Eslint

Installation

  • git clone https://github.com/p8ul/apollo-graphql-express-boilerplate.git
  • cd apollo-graphql-express-boilerplate
  • yarn
  • start PostgreSQL database
  • create two databases for testing and development
  • create a .env file and copy the keys from .env.example file
    # Your Graphql Port
    PORT=4000
    # Decoding Secret
    SECRET="awesome_secret"
    DATABASE_NAME= # the name of the PostgreSQL database
    DATABASE_USERNAME= # username  of the PostgreSQL database
    DATABASE_PASSWORD= # password of the username
    TEST_DATABASE_NAME= # test database name

Running the app

  • yarn start
  • navigate to http://localhost:4000/graphql

Playground

  1. Sign Up
mutation {
  register(name: "admin", email: "[email protected]", password: "123456") {
    token
  }
}
  1. Login
mutation {
  login(email: "[email protected]", password: "123456") {
    token
  }
}
  1. List Users
query {
  users {
    email
    name
    id
  }
}
  1. Add Post
mutation {
  addPost(
    title: "Combo House"
    body: "this is a post body"
    file: "http://modern.realhomes.io/wp-content/uploads/2015/07/property-10-exterior-680x510.jpg"
  ) {
    title
  }
}
  1. List Post
query {
  posts{
    title
    id
    file
  }
}
  1. Post added subscription
subscription {
  postAdded {
    title
    body
    file
  }
}

More Schemas.. Schemas

testing

  • run yarn test

apollo-graphql-express-boilerplate's People

Contributors

p8ul 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.