import { NextFunction , Request , Response } from 'express' ; import * as discoveryLinks from '../discoveryLinks.json' ; import { ParseError , ParseErrorType } from '../utils/errors' ; param req param res param next returns throws export default function constructJrd ( req , res , next ) { const payId = req . query . resource ; if ( ! payId || Array . isArray ( payId ) || typeof payId !== 'string' ) { throw new ParseError ( 'A PayID must be provided in the `resource` request parameter.' , ParseErrorType . MissingPayId ) ; } res . locals . response = { subject : payId , links : discoveryLinks , } ; return next ( ) ; }