or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-1/

API Request Logger

Build a logging system for a web API that captures and logs HTTP requests with extracted route parameters.

Capabilities

Route-based logging

  • It logs GET requests to the /users/:id endpoint with the user ID extracted from the path @test
  • It logs POST requests to the /users endpoint without parameters @test
  • It logs DELETE requests to the /users/:id endpoint with the user ID extracted @test
  • It logs requests to the /api/:resource/:action endpoint with both resource and action parameters extracted @test

Implementation

@generates

API

/**
 * Creates a Koa application with route-based logging middleware.
 * Returns the configured Koa app instance.
 *
 * The logger should capture:
 * - HTTP method
 * - Route path pattern
 * - Extracted parameters
 *
 * @returns {Object} Configured Koa application instance
 */
function createLoggerApp() {
  // IMPLEMENTATION HERE
}

module.exports = { createLoggerApp };

Dependencies { .dependencies }

koa { .dependency }

Provides the web application framework.

koa-route { .dependency }

Provides route middleware support with path parameter extraction.