Skip to content

Owen-Cummings/ShopifyDevChallenge2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopify Dev Challenge 2019

This is my solution for the 2019 Shopify Dev Challenge. The solution is written in GO using graphQL, and mySQL for the database

Requirements:

  • Go
  • MySQL

API Setup

  • Download the project into your $GOPATH/src directory and run setup.sh to install all of the go dependencies
  • Configure the MySQL connection information for your testing environment
    • Run the attached SQL scripts in your database terminal to set up the required tables
  • Generate self signed keys for TLS in the project folder:
$ openssl genrsa -out server.key 2048
$ openssl ecparam -genkey -name secp384r1 -out server.key
$ openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650

openssl genrsa -out server.key 2048

$ sh setup.sh
$ go build main.go

Testing

To test use Postman or your API testing app of choice.

POST Formatting:

{
    "request": "type{Field(parameters){return values}}"
}

Example post requests:

# Return products that are in stock
{
 "request": "query{GetProducts(InStock:true){id, title, price, inventorycount}}"
}

# Return products with CPU int title
{
 "request": "query{GetProducts(Title:\"CPU\"){id, title, price, inventorycount}}"
}

# Return products with title CPU that are in stock
{
 "request": "query{GetProducts(Title:\"CPU\",InStock:true){id, title, price, inventorycount}}"
}

# Return contents of Cart 1
{
 "request": "query{GetCartContents(CartID:1){productid, title, price}}"
}

# Add Item with ID 2 to Cart 1
{
 "request": "mutation{AddToCart: AddToCart(CartID:1,ItemID:2)}"
}

# Check out cart with ID 1
{
 "request": "mutation{CheckOut(CartID:1)}"
}

About

2019 Shopify Dev Challenge Solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published