Skip to content

TeachersPayTeachers/nomnomsfarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NomNomsFarms

A simple Elixir toy app built to demonstrate how we can set up a GraphQL endpoint for registering users, and storing user and other relevant information to a database. Our goal is to persist only data that is valid, or return a helpful error otherwise. We’ll leverage Ecto.Multi and Ecto.Repo.transaction to write a clean user registration flow and handle errors elegantly.

Problem

NomNomsFarm is a new food cart serving the neighborhood with local, organic, fair trade, free-range, farm-fresh, artisinal delicacies. We're in charge of running logistics for NomNomsFarm and we need to build an online registration flow for local farms to become part of the food cart's supply chain.

Instructions

  1. Clone the repo.
  2. Run mix deps.get to download the dependencies.
  3. In the repo run mix setup. (This will create the database, migrate the schema, and seed the USDA farms table.)

To run the app

  1. run iex -S mix phx.server
  2. Go to http://localhost:4000/graphiql
  3. Run mutations. Try:
  mutation {
    registerFarmAdmin(
      username: "bart",
      password: "password",
      name: "Bartleby",
      email: "bart@bartlebysons.com",
      usdaUid: "00920",
    )
  }

To run the tests

  1. Run MIX_ENV=test mix setup
  2. run mix test

Please reach out with questions, comments or suggestions for how we can improve.

Thanks!

About

toy app to try out some db transaction fun.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages