코드 5-21 구매 내역 조회
예제 파일 : monolithic_purchases.js
...... function inquiry(method, pathname, params, cb) { var response = { key: params.key, errorcode: 0, errormessage: "success" }; if (params.userid == null) { response.errorcode = 1; response.errormessage = "Invalid Parameters"; cb(response); } else { var connection = mysql.createConnection(conn); connection.connect(); connection.query("select id, goodsid, date from purchases where userid = ?" , [params.userid] , (error, results, fields) => { if (error) { response.errorcode = 1; response.errormessage = error; } else { response.results = results; } cb(response); }); connection.end(); } }