boxlang-express 0.2.31

Released .

  • Lifecycle events (models/LifecycleEvents.bx, docs/lifecycle-events.md). BoxLang's own onRequestStart / onRequestEnd / onError interception points never fire for a BoxExpress request, so the framework now announces its own: onExpressRequestStart ({ req, method, path, startedAt }, before any middleware), onExpressError ({ exception, method, path, route, responseSent }, once per request, the first time an error is thrown or passed to next( err )) and onExpressRequestEnd ({ method, path, route, status, durationMs }, once per request after the response is sent). Listen with boxRegisterInterceptor(). route is the matched pattern with the method (GET /feeds/:id), or <unmatched>. A listener that throws is logged and cannot change the response. A point with no listener is skipped before its data is built, so an app that doesn't listen behaves as before.
  • req.routePattern (models/Router.bx) is the pattern of the matched route as registered (/feeds/:id), with the mount path in front inside a mounted router. Unset until a route matches, and emptied if that route calls next().
  • An error no error handler answers is logged (models/Router.bx). The default 500 was sent without printing anything, although the docs said the real message went to stdout. It now prints Unhandled error, GET /path: message, with the request id when requestId is on. The response is unchanged.
  • A ? inside the path is kept in the access log (models/HttpBridge.bx). A request for /files/what%3Fnow.txt was logged as /files/what, because the path was cut at the first ? after decoding. The lifecycle events report the full path too.
  • ModuleConfig.bx reported version 0.2.29 in the 0.2.30 release; it is back in step with box.json.