Considering that we use our imported middleware for JSON input Validation and Requesting MySQL connection, we have: app.post('/add/product', validate.JsonValidation, mysqlConnection. A fairly simple way of doing it is having the async keyword on our last RESTful endpoint's function. See example below.In order to use the async/await model in a REST endpoint, we must consider that an "await for a promise" command requires an async function to call them. In the meantime, the caller of the async function resumes execution.
0 Comments
Leave a Reply. |