Skip to content

📝Pass the Story backend - Written in golang with gqlgen and gorm.

License

Notifications You must be signed in to change notification settings

scorpionknifes/pts-backend

Repository files navigation

Pass the Story Backend

Build Status Go Report Card Docker Status

Hosted on Azure and Self Hosted

This project is an assignment for Microsoft Student Accelerator NZ 2020 Phase 2.

Pass the Story Backend for frontend.

Using Docker image to run golang on azure.

The following project uses:

Microsoft Student Accelerator 2020-Phase-2

Setup

  1. Install Golang
  2. git clone project
  3. setup .env file using template (connect to azure SQL server)
  4. Read How to use

How to use

Golang Commands - go mod will auto install dependency

go run server.go
go build server.go
go test ./...

Docker Commands

docker build -t pts-backend .
docker run --publish <PORT>:<PORT> --name test --rm pts-backend
docker stop test

gqlgen Commans

gqlgen generate // run when change schema.graphql

Example Queries

Click to expand!

# Write your query or mutation here
query stories {
  stories{
    id
    name
    count
    people
    tags
    createdAt
    updatedAt
  }
}

mutation createStory {
  createStory(input: {
    name: "Anonymous's 2000",
    tags: "example, cool, love"
  }){
    id
    name
    tags
  }
}

subscription subscriptionStory {
  stories{
    id
    name
    count
    people
    tags
    createdAt
    updatedAt
  }
}

query Story {
  story(id: 1) {
    id
    name
    turns{
      id
      value
      user{
        id
      }
    }
    count
    people
    tags
    createdAt
    updatedAt
  }
}

About

📝Pass the Story backend - Written in golang with gqlgen and gorm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages