Git Product home page Git Product logo

golang-relay-starter-kit's Introduction

Golang-Relay Starter Kit

This kit includes:

  • a NodeJS app server: to serve the front-end written with react-relay
  • a Golang GraphQL server: to serve the back-end graphql-go server that handles GraphQL queries
  • a Babel transpiler workflow using webpack that you can use to get started building an app with Relay.

For a walkthrough, see the Relay tutorial.

Notes:

This is based on alpha version of graphql-go and graphql-relay-go. Be sure to watch both repositories for latest changes.

Installation

  • Install dependencies for NodeJS app server
npm install
  • Install dependencies for Golang GraphQL server
go get -v

Running

Start a local server:

npm start

The above command will run both the NodeJS app server and Golang GraphQL server concurrently.

Developing

JavaScript

Any changes you make to files in the js/ directory will cause the server to automatically rebuild the app and refresh your browser.

Golang

Schema data

Since Golang does not support loading package / module dynamically, remember to update the package import for schema data in:

  • graphql.go
  • scripts/updateSchema.go

For e.g

import (
  ...
  "github.com/sogko/golang-relay-starter-kit/data" // <--- update to package containing schema
)

Schema updates

If at any time you make changes to data/schema.go, stop the server, regenerate data/schema.json, and restart the server:

npm run update-schema
npm start

schema.json is needed by the JS code for ./build/babelRelayPlugin.js

Examples

  • todomvc-relay-go - Port of the React/Relay TodoMVC app, driven by a Golang GraphQL backend

Feel free to submit a PR to add to this list.

TODOs

  • Swap out express-graphql server with a Golang GraphQL server
  • GraphQL schema definition in Golang
  • Generate schema.json from schema definition for babel-relay-plugin
  • Generate schema.graphql from schema definition

Credits

This kit is build on top of https://github.com/relayjs/relay-starter-kit

golang-relay-starter-kit's People

Contributors

sogko avatar zhujiaqi avatar

Watchers

James Cloos avatar  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.