/node-show-case

Primary LanguageTypeScript

About

This is an example graphql backend for a fitness app, to be used together with https://github.com/skeie/rn-show-case. The app has limited seed data, so you'd have to add this yourself.

Getting Started

  1. Download & Install Dependencies
  • Install Node.js (Mac)

  • Install Postgres (Mac)

    # Install dependencies
    $ yarn
    $ createdb node_showcase && createdb node_showcase_test
    $ yarn run migrate:up
    $ yarn run migrate:up:test
    $ yarn start
    $ open http://localhost:3000/graphql

Resources

Testing

yarn run test:unit
yarn run test:integration

# update snapshots
SNAPSHOT_UPDATE=1 yarn run test:integration

Database

create migration:

yarn run migrate create <name> --sql-file

Sometimes we change current migrations instead of adding new ones. In that case:

yarn resetdb

/schemas

This is where we have our graphql schema types layed out. We also define entry points for the query resolvers and mutations

/app/Queries

This is where we put our query resolvers. It should use StoreDataSources to manipulate the database, and DataSources to call external services

/app/Mutations

This is where we put our mutations. It should use StoreDataSources to manipulate the database, and DataSources to call external services

/app/StoreDataSource

This is where we manipulate the database

/app/DataSource

This is where we call external services

/app/Reducers

This is where we serialize data from the StoreDataSources