score:0
router.get("/occ", authorization, async (req, res) => {
try {
console.log(req);
const result = await pool.query(
// "select occupation,count(occupation) from resources group by occupation;",
"select occupation,count(occupation) as values from resources group by occupation"
);
console.log(req);
console.log(result);
res.status(200).json({
status: "success",
data: {
occupationresults: result.rows, //this gets the one row we need
},
});
} catch (err) {
console.error(err.message);
}
});
Source: stackoverflow.com
Related Query
- how do I set up a grouping query on the server side. I want set up the query so I can use it for a pie chart in front end, using d3js
- How to set the background-color of a D3.js svg?
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- How to set the origin while drag in d3.js in v4
- how to set the domain and scale on an axis on a nvd3.js multiBarChart
- D3 force layout: How do I set the size of every node?
- D3js: How do I clear the zoom scale set by the d3.zoom event?
- How to use D3js on server side to generate SVG directly?
- How to set the Origin (drag.origin) for drag behavior in d3 JavaScript library
- D3: How do I set "click" event and "dbclick" event at the same time?
- How to set the size of a d3 symbol?
- How can I set min/max of the x-axis in Rickshaw / D3?
- How can I set the each line color or width in SVG path
- How to set the domain and scale on an yaxis on a discreteBarChart nvd3.js
- How to set circle at the right end of the last bar / item using D3
- dc.js - how to get the average of a column in data set
- How do I set the focal node in a D3.js Force Directed Graph?
- How to set the image size in Vis.js network graph
- How to set SVG's(Draw by D3.js) height based on the content?
- How can I set the position of a drop down list with D3.js?
- How do you retrieve the key values of a nested data set in D3
- How do I set custom ticks along the Xaxis in D3? or name the bars in a bar chart?
- How to set the zoom factor in D3.js v.4.x?
- svg: How to set a circle on the calculated line?
- How to set the label for each vertical axis in a parallel coordinates visualization?
- How to append javascript file to the body from javascript file which is in the same directory. Java server faces 2 JSF2
- Passing JSON from Grails Controller to d3 - how to get the .gsp side working?
- How to retrieve the key values of a nested data set in D3
- D3, Scale How to set the scale?
- How do I set the large-arc or sweep flag in d3.svg.arc()
More Query from same tag
- Place text inside a circle. d3.js
- d3 animate path by arc
- Merging arrays that hold CSV data into one object array
- Bostock's d3 Object Constancy example: what is effect of d3.transition().each?
- Dot Plot in D3.js
- dc.js ordinal stacked barchart with two dimensions, getting NaN values and no stacked bar is displayed
- D3 horizontal Barchart using react-d3-components package
- Redisplaying div in flex layout after display:none
- dc charts change legend order
- D3 v4 Grid: How do I bind the data properly?
- Creating a simple D3 bar chart
- Passing Data to D3 from Angular directive
- How to check if nodes are related? How do I chose only one neighbour if it has two?
- How to set fixed no. of ticks on axis in d3.js?
- Translating mouse-over text in NVD3.js
- d3 reading csv/tsv files if column names are numbers?
- How do implement d3 v3 brush by specifying a increment brush slide value in steps programmatically
- d3.js: Drawing arcs between two points on map from file
- d3.js Force Chart - image/node linkage and animation
- Explanation of D3 animated line drawing required
- How to modify axis labels in d3 for a stacked bar chart when the axis labels are mapped as part of the scale's domain
- Is it possible to position the leaf nodes one below the other instead of next to each other?
- d3js - finding issue with converting `json` to date value
- Comparing different size arrays - D3 JS
- Opening downloaded Gist folder to inspect elements
- Convert array to object in javascript same as d3 output
- How to use call function?
- In d3 force directed, how do I change a nodes shape by clicking on it?
- Background image not filling circle - D3/JavaScript
- AJAX is not a function error in d3/flask interface