Step 2 - Create the route to handle the Smart Chart
routes/dashboard.js
constexpress=require('express');constrouter=express.Router();constLiana=require('forest-express');...router.post('/stats/top-5-buyers',Liana.ensureAuthenticated,async (request, response) => {constquery=` SELECT firstname || ' ' || lastname AS key, total_quantity AS value FROM (SELECT buyerid, sum(qtysold) total_quantity FROM sales GROUP BY buyerid ORDER BY total_quantity desc limit 5) Q, users WHERE Q.buyerid = userid ORDER BY Q.total_quantity desc `; constdata=awaitredshiftClient.query(query);let leaderboard =data.rows;let json =newLiana.StatSerializer({ value: leaderboard }).perform();response.send(json);});