module
Noir::TreeSitterHapiExtractor
Overview
Tree-sitter-backed Hapi extractor.
Hapi routes are object-literal configs passed to
server.route({...}) (or an array of them):
server.route({
method: 'GET',
path: '/users/{id}',
handler: (request, h) => { ... }
});
server.route([
{ method: 'POST', path: '/users', handler: ... },
{ method: ['PUT', 'PATCH'], path: '/users/{id}', handler: ... },
]);
Recognised:
- Single object or array-of-objects route config.
method:as a string, an array of strings, or'*'(any-method — fans out to GET/POST/PUT/DELETE/PATCH).path:as a string literal.handler:arrow function — body scanned forrequest.query.X,request.headers['x']/request.headers.x,request.payload,request.state.X.
Out of scope for this first cut:
options.validateconstraint synthesis (Joi schemas).- Pre-handler chains (
pre: [...]). server.routeregistered through plugins / wildcards in the receiver (api.route, etc.) — receiver name is ignored, so only the.route(...)shape matters.
Extended Modules
Defined in:
miniparsers/hapi_extractor_ts.crConstant Summary
-
ANY_METHOD_VERBS =
["GET", "POST", "PUT", "DELETE", "PATCH"] -
HTTP_VERBS =
Set {"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"}