CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/go-error-handling

Error handling for Go HTTP servers — structured error responses, error wrapping,

88

1.80x
Quality

81%

Does it follow best practices?

Impact

99%

1.80x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

Build a Recipe Sharing API

Problem/Feature Description

A cooking community wants a backend API for sharing recipes. Build it in Go using the standard library.

Resources:

  • Recipe: { id, title, author, ingredients (list of strings), instructions, servings, prepTimeMinutes, createdAt }
  • Rating: { id, recipeId, score (1-5), comment, createdAt }

Endpoints:

  • GET /api/recipes -- list all recipes
  • GET /api/recipes/{id} -- get a recipe with its average rating
  • POST /api/recipes -- create a recipe (title, author, ingredients, instructions all required; servings > 0)
  • PUT /api/recipes/{id} -- update a recipe (only the original author can update -- pass X-User header)
  • DELETE /api/recipes/{id} -- delete a recipe (only the original author)
  • POST /api/recipes/{id}/ratings -- add a rating to a recipe (score 1-5 required)
  • GET /api/recipes/{id}/ratings -- list ratings for a recipe

Use in-memory storage.

Output Specification

Produce:

  • main.go -- entry point
  • Source files for handlers, models, middleware, errors
  • go.mod

You may split across files as you see fit.

evals

tile.json