Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/postgres-graphqlPublic template
NotificationsYou must be signed in to change notification settings

ncrmro/postgres-graphql

Repository files navigation

This is an example project using the following technologies to provide a GraphQLserver.

The main benefit here is our GraphQL API types come directly from the Database,furthermore in our frontend applications we can automatically generateTypescript Types and Typed requests to interact with our API improvingdevelopment agility and our application's integrity.

This README contains the following sections.

Getting Started

The only hard requirement is that you havedocker anddocker-composeinstalled, although naturally, you could install everything locally.

.env

First, let's copy the.env.example to.env. This file used bydocker-compose will pass these environment variables into designatedcontainers.

cp .env.example .env
sh ./init.sh
docker-compose up database migrations

Write some migrations incurrent.sql, once you're ready to commit.

Note I like to keep the minimum amount of logic in a specific commit to makeyour schema easier to read in the future, this also keeps your agility up inregards to developing new features.

docker-composeexec migrations yarn graphile-migrate commit -m"my commit message"

If you need to reset the database and rerun committed migrations.

docker-composeexec migrations yarn graphile-migrate reset --erase

GraphQL

Once we have our database up and running with a schema we can go ahead and startthe GraphQL server.

docker-compose up database migrations gql

Or using up without and other parameters would start all availabledocker-compose services

docker-compose up database migrations gql

Note that because GraphQL specifies migrations as a dependency and migrationsspecify database as a dependency we could also start everything up with thefollowing command, although this would only output logs from the gql servicehiding other crucial logs.

docker-compose up database migrations gql

GraphiQL

Postgraphile comes with a nifty interface to aid in development called GraphiQL,this allows us to inspect our current GraphQL schema at the following URL.

http://localhost:5000/graphiql

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp