Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikolasburk/muc-coding-night
Starter project for the GraphQL Coding Night in Munich
https://github.com/nikolasburk/muc-coding-night
Last synced: 25 days ago
JSON representation
Starter project for the GraphQL Coding Night in Munich
- Host: GitHub
- URL: https://github.com/nikolasburk/muc-coding-night
- Owner: nikolasburk
- Created: 2017-11-09T12:34:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T13:06:52.000Z (about 7 years ago)
- Last Synced: 2024-10-09T19:02:24.974Z (about 1 month ago)
- Language: JavaScript
- Size: 71.3 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-chat
## Clone the repository
```sh
git clone [email protected]:nikolasburk/muc-coding-night.git
cd muc-coding-night
```## Get your GraphQL endpoint
### 1. Install Graphcool CLI
You first have to install the [Graphcool CLI](https://www.graph.cool/docs/reference/cli/overview-kie1quohli/):
```sh
npm install -g graphcool
```### 2. Bootstrap local file structure for GraphQL server
```sh
graphcool init server # create files in new directory called `server`
```### 3. Configure data model
Paste the following data model into the new file `server/types.graphql` and save the changes:
```graphql
type Person @model {
id: ID! @isUnique # required system-field (read-only)
createdAt: DateTime! # optional system-field (read-only)
updatedAt: DateTime! # optional system-field (read-only)
name: String!
messages: [Message!]! @relation(name: "UserMessages")
}type Message @model {
id: ID! @isUnique # required system-field (read-only)
createdAt: DateTime! # optional system-field (read-only)
updatedAt: DateTime! # optional system-field (read-only)
text: String!
sentBy: Person! @relation(name: "UserMessages")
}
```> Every type that's annotated with the `@model` directive is mapped to the database.
### 4. Deploy the GraphQL server
Navigate into the `server` directory and deploy the server:
```sh
cd server
graphcool deploy
```When prompted, choose any of the **Shared Clusters**, e.g. `eu-west-1`.
## Run the app 🚀
That's it, you can now start the app:
```sh
yarn install
yarn start
```Go to **http://localhost:3000** in your browser to start chatting 💬