April 2020
Intermediate to advanced
292 pages
6h 50m
English
Speaking of the home page application, it currently isn’t using our Aggregator’s output. Let’s fix that:
| | function createQueries ({ db }) { |
| | function loadHomePage () { |
| | return db.then(client => |
| | client('pages') |
| | .where({ page_name: 'home' }) |
| | .limit(1) |
| | .then(camelCaseKeys) |
| | .then(rows => rows[0]) |
| | ) |
| | } |
| | |
| | return { |
| | loadHomePage |
| | } |
| | } |
We just need to modify the loadHomePage query. Instead of querying the monolithic videos table, we’re going to query the special-purpose pages table. We want the one where page_name is equal to home. Notice how there was no summation to do, no joins. We built laser-focused View Data to serve this ...
Read now
Unlock full access