UNPKG

@equinor/fusion-framework-cli

Version:

Command-line toolkit for developing, building, and publishing Fusion Framework applications and portal templates. Provides a unified developer experience from local development to production deployment.

19 lines 694 B
/** * Extracts and parses JSON data from an incoming HTTP request. * * @param req - The incoming HTTP request object. * @returns A promise that resolves to a record containing the parsed JSON data. * @throws Will reject the promise if there is an error during data reception or JSON parsing. */ export async function parseJsonFromRequest(req) { return await new Promise((resolve, reject) => { let data = ''; req.on('data', (chunk) => { data += chunk.toString(); }); req.on('end', () => resolve(JSON.parse(data))); req.on('error', reject); }); } export default parseJsonFromRequest; //# sourceMappingURL=parse-json-request.js.map