December 2018
Intermediate to advanced
642 pages
15h 5m
English
As we saw previously, there are three possible routes to handle:
We can handle all three cases in a similar way by just changing the SQL SELECT we'll be doing. Handling the results, however, will require a special case, as we'll note in the following code:
// Source file: src/restful_regions.jsconst getRegion = async ( res: any, dbConn: any, country: ?string, region: ?string) => { try { res.set("Connection", "close"); let sqlQuery = ""; let regions; if (country == null) { sqlQuery = ` SELECT rr.* FROM regions rr JOIN countries ...Read now
Unlock full access