Next.js · Senior · Question 41 of 75
What does after() in a Route Handler give you compared to await logEvent() before responding?
- ✓Correct answer: The response is sent immediately, and logging runs afterwards
- 2
afterruns code before the server even receives the request - 3
afterguarantees that logging is transactional with the response
Explanation
The user doesn't have to wait for analytics, logs or syncing with third-party services. The platform keeps the function alive until the after callbacks finish. Inside, you can read cookies() and headers() in Server Actions and Route Handlers.