RyanMarcus icon

Untitled

RyanMarcus | PRO | 12/17/15 06:23:18 PM UTC | 0 ⭐ | 248 👁️ | Never ⏰ | []
JavaScript |

280 B

|

None

|

0 👍

/

0 👎

function getUser(id) {
    return this.db.one("select *...");
}
 
app.get("/user/:id", (req, res) => {
    getUser(req.params.id).then(data => {
        //  use the data
        // return another promise if you need
        // another async call
    }).catch(err => {
        // handle the error;
    });
})

Comments