Files
main.tsmain
What you'll learn
- Log every request and response with logger(), and route the lines somewhere with its print function
- Tag every request with requestId(): reuse the id a client sent, generate one otherwise, expose it on the response and on the context
- Prettify JSON on demand with prettyJSON() and its ?pretty query
Press Run tests to start the app. Its log appears here.Graded endpoints
requestId() reuses the incoming X-Request-Id and puts it on the response
c.get('requestId') inside the handler is the same id, so a log line and a response can be matched
With ?pretty the same JSON is indented by two spaces; without it, compact
Still the 404 from Basics; the logger records the 404 like any status
logger()'s print function kept every line: an incoming arrow per request and an outgoing one with the status and the time