Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Glyphack/graphql-golang
A tutorial📚 for creating GrahpQL APIs in go
https://github.com/Glyphack/graphql-golang
Last synced: about 2 months ago
JSON representation
A tutorial📚 for creating GrahpQL APIs in go
- Host: GitHub
- URL: https://github.com/Glyphack/graphql-golang
- Owner: Glyphack
- Created: 2019-11-26T16:01:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T06:13:25.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T05:10:41.883Z (5 months ago)
- Language: Go
- Homepage: https://www.howtographql.com/graphql-go/0-introduction/
- Size: 69.3 KB
- Stars: 45
- Watchers: 5
- Forks: 33
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: ‌Introduction To GraphQL Server With Golang
published: false
description: Introduction to GraphQL Server with Golang and Gqlgen.
tags: graphql, go, api, gqlgen
---
## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [How to Run The Project](#how-to-run-project)
- [Motivation ](#motivation)
- [What is a GraphQL server?](#what-is-a-graphql-server)
- [Schema-Driven Development](#schema-driven-development)
- [Getting started ](#getting-started)
- [Project Setup](#project-setup)
- [Defining Our Schema](#defining-out-schema)
- [Queries](#queries)
- [What Is A Query](#what-is-a-query)
- [Simple Query](#simple-query)
- [Mutations](#mutations)
- [What Is A Mutation](#what-is-a-mutation)
- [A Simple Mutation](#a-simple-mutation)
- [Database](#database)
- [Setup MySQL](#setup-mysql)
- [Models and migrations](#models-and-migrations)
- [Create and Retrieve Links](#create-and-retrieve-links)
- [CreateLinks](#createlinks)
- [Links Query](#links-query)
- [Authentication](#authentication)
- [JWT](#jwt)
- [Setup](#setup)
- [Generating and Parsing JWT Tokens](#generating-and-parsing-jwt-tokens)
- [User Signup and Login Functionality](#user-signup-and-login-functionality)
- [Authentication Middleware](#authentication-middleware)
- [Continue Implementing schema](#continue-implementing-schema)
- [CreateUser](#createuser)
- [Login](#login)
- [RefreshToken](#refresh-token)
- [Completing Our App](#completing-our-app)
- [Summary](#summary)
- [Further Steps](#further-steps)
### How to Run The Project
First start mysql server with docker:
```bash
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=dbpass -e MYSQL_DATABASE=hackernews -d mysql:latest
```
Then create a Table names hackernews for our app:
```sql
docker exec -it mysql bash
mysql -u root -p
CREATE DATABASE hackernews;
```
finally run the server:
```bash
go run server/server.go
```
Now navigate to https://localhost:8080 you can see graphiql playground and query the graphql server.### Tutorial
to see the latest version of tutorial visit https://www.howtographql.com/graphql-go/0-introduction/