A small helper for marking points during a request, so you can see where the time actually went.
1import { measureTiming, elapsedSinceRequestStart, res } from "apiker";2 3const handler = async ({ state }) => {4 const start = measureTiming("lookup-start");5 const user = await state("Users").get("profile");6 7 return res({8 lookupMs: Date.now() - start,9 totalMs: elapsedSinceRequestStart()10 });11};measureTiming records the current time under a name and returns it. elapsedSinceRequestStart reports how long the request has been running — the start mark is set for you when the request arrives.
Marks live for the length of one request. To keep them, write the numbers into a log entry or a beacon property.


