Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

Recruitment task for Shopify for Backend Engineer Intern.

Notifications You must be signed in to change notification settings

Albert221/shopify-recruitment-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopify Backend Engineer recruitment task

This repo consists of the source code for a recruitment task for Shopify's Backend Engineer Intern position.

Summer 2019 Developer Intern Challenge Question

Thought process

My plan was to create a GraphQL API with cart functionality with well-written code.

  1. At first, I wrote on a sheet of paper queries, mutations and types I’d need for such API.
  2. Initially, I wanted to give Prisma with TypeScript a try (never used that), but after few hours of fighting with Docker I gave up, I had some hardware problem.
  3. I chose Go for this, I have some experience with Go.
  4. I started with writing domain structures (that is models/entities - purchase, product, etc.).
  5. Then I proceeded to writing first working resolver, for all products.
  6. After writing the rest of queries and mutation for purchasing single product I refactored some of the code to be more abstract and because of that more testable and universal.
  7. I began doing extra credit, I solved cart authorization using JWT. When creating a cart, you got a JWT with cart id in claims in response which you have to submit in Authorization header when you are dealing with cart endpoints.

Installation

You can use one of the prebuilt binaries in the Releases section or build it yourself using instruction below.

After first run, you can edit config.ini file and then re-run program with new settings. You probably also want to populate the products SQL table with some content.

Requirements

  • Go 1.10.3+
  • dep dependency manager
  • GCC for compiling SQLite driver (not sure if it's needed)

Compiling

  1. Clone GitHub repository
  2. Download all dependencies by dep ensure
  3. You are ready to build! go build main.go

API

List of queries and mutations can be found in schema.graphql file which describes it best (it's the actual schema).

Cart resolvers

showCart, addToCart and checkoutCart resolvers need a JWT token submitted in Authorization header in order to work. You can acquire this token from createCart query.

About

Recruitment task for Shopify for Backend Engineer Intern.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages