FACN3 / spend500

week 7 project
0 stars 1 forks source link

Destructure qs.parse #45

Open finnhodgkin opened 6 years ago

finnhodgkin commented 6 years ago

In handleCreateUser you're repeatedly calling qs.parse on the same data, this only needs to be done once:

    const parsedDetails = qs.parse(data);
    const pass = parsedDetails.pass;
    const user = parsedDetails.user;
    const first = parsedDetails.first;
    const last = parsedDetails.last;
    const address = parsedDetails.address;

Or in one line:

const {pass, user, first, last, address} = qs.parse(data);