Giter Club home page Giter Club logo

cngraps's Introduction

Complete GraphQL server and create-react-app client

This project contains

  • a Node.js graphQL server using Express, Apollo server, Sequelize, PostgreSQL, SendGrid and Slack
  • create-react-app client using Ant Design for its UI, Apollo Client and less.

The server is already configured with SubscriptionServer middleware even if there's no subscriptions defined in schema and resolvers.

Installation

First step

git clone ...

Configuration

Environnement file

cp .env.default .env

Edit .env

TODO DESCRIBE .env

TODO HOW TO GET SENDGRID API

TODO HOW TO SET SLACK

Database

CREATE USER myuser;
ALTER USER myuser WITH ENCRYPTED PASSWORD 'mypassword';
CREATE DATABASE mydatabase;
GRANT ALL PRIVILEGES ON DATABASE mydatabase TO myuser;

Install module and migrate database

npm install

Start

Development

npm run dev

Production

npm run build
npm run prod

Deploy Heroku

heroku create
heroku addons:create heroku-postgresql:hobby-dev
heroku config:set NODE_ENV=production
heroku config:set SECRET=thisismysecret
git push heroku <currentbranch>:master

Cf. Environnment file description above

Heroku deploy uses postinstall npm script to build the application and start npm script to start the server.

Test

Using GraphiQL

http://localhost:5005/graphiql

{
  allUsers {
    id,
    name,
    email
  }
}
mutation {
  register(
    name: "Admin",
    email: "[email protected]",
    password: "admin"
  ) {
    token,
    refreshToken
  }
}
mutation {
  login(
    email: "[email protected]",
    password: "admin"
  ) {
    token,
    refreshToken
  }
}

Contribution

All contribution are very welcome especially for improving repository documentation and tests. For example, we could add a deploy in Heroku button. Please use issues for bug report and feature requests.

Tutorials & References

https://www.youtube.com/user/99baddawg

https://www.youtube.com/watch?v=DNPVqK_woRQ

cngraps's People

Contributors

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