Advanced Example: Writing an API for an existing Postgres Database

A small startup aims to serve up searchable, filterable list of movies via their app. The CTO, their only founding engineer, builds a database schema and seeds a Postgres database with some sample records. Now, we need a Node/Express API built to interact with this database and serve data to the frontend application.

We can offload this task to EngineerDAO. Let's define some requirements:

Our CTO wants full test coverage, but instead of outsourcing that task - they opt to write tests upfront (ala. TDD.) These tests can now be used as acceptance criteria! In the most rigorous implementation of the EngineerDAO philosophy, we could actually create a containerized testing environment that runs the code upon contract submission, and auto-accepts the submission based on passing tests. Here's how this might look:

  1. Our CTO supplier writes acceptance tests in Jest.
  2. The EngineerDAO app is used to create a small, containerized Node.js testing environment bound to the job contract. Tests are uploaded to this container with an npm run test command that runs tests against a given index.js .
  3. As our engineer completes their task, they use the EngineerDAO app to upload their work to the testing environment according to the suppliers instructions. Their public key is submitted to receive payment.
  4. If all tests pass, EngineerDAO pays the engineer their bounty + buy-in and closes the contract. The supplier is notified that their code is available for download.

Awesome! This is [robot mode]. Realizing that many tasks are difficult to thoroughly test in this manner, we'll offer an alternative that relies upon supplier verification.