TDDing http4k
This post is a guide to how we build http4k applications test first to provide excellent test coverage driven by decoupled tests.
Application Design
For this example, we will use an example of a Maths app with the following requirements:
- The app must add 2 numbers together via an HTTP call
- The app must multiply 2 numbers together via an HTTP call
- Answers generated by the service will be logged (via HTTP POST) to another server - the Recorder.
Apps can generally be split into 3 tiers:
- Endpoint:
HttpHandlers
are constructed individually, by providing a builder function which takes the business-level dependencies. - Application: Builder function which takes the transport-level dependencies, and converts them into business-level dependencies. All routes are constructed and collected in this tier.
- Server: Builder function which takes the configuration for environmental concerns such as ports and downstream urls.
The tutorial is split into 4 sections:
- Part 1: Building a walking skeleton
- Part 2: Adding an endpoint
- Part 3: Adding another endpoint
- Part 4: Adding an external dependency
Serverless http4k with AWS Lambda
A step-by-step guide to deploying an HTTP app to AWS Lambda
Going native with Graal on AWS Lambda
A step-by-step guide to compiling http4k apps with GraalVM for AWS Lambda
TDDing http4k Part 1: Building a walking skeleton
A step-by-step guide to TDDing a simple http4k application
TDDing http4k Part 2: Adding an endpoint
A step-by-step guide to TDDing a simple http4k application
TDDing http4k Part 3: Adding another endpoint
A step-by-step guide to TDDing a simple http4k application
TDDing http4k Part 4: Adding an external dependency
A step-by-step guide to TDDing a simple http4k application