async function parseRequest(req) {
  return new Promise((resolve, reject) => {
    let data = [];

    req.on('data', (chunk) => {
      data.push(chunk);
    });
    req.on('error', (err) => reject(err));
    req.on('end', () =>
      resolve({
        body: data.join(''),
        query: url.parse(req.url, true).query,
      })
    );
  });
}
/*
 * Parse an incoming request into a text body and query params.
 */
Parse an incoming request into a text body and query params.
Parse an incoming request into a text body and query params .
async function parseRequest(req) {
  return new Promise((resolve, reject) => {
    let data = [];
    req.on('data', (chunk) => {
      data.push(chunk);
    });
    req.on('error', (err) => reject(err));
    req.on('end', () =>
      resolve({
        body: data.join(''),
        query: url.parse(req.url, true).query,
      })
    );
  });
}
async function parseRequest ( req ) { return new Promise ( ( resolve , reject ) => { let data = [ ] ; req . on ( 'data' , ( chunk ) => { data . push ( chunk ) ; } ) ; req . on ( 'error' , ( err ) => reject ( err ) ) ; req . on ( 'end' , ( ) => resolve ( { body : data . join ( '' ) , query : url . parse ( req . url , true ) . query , } ) ) ; } ) ; }
Parse an incoming request into a text body and query params.
Parse an incoming request into a text body and query params .