added popcenCount
This commit is contained in:
@@ -40,6 +40,20 @@ app.get('/popcen', (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.get('/popcenCount', (req, res) => {
|
||||||
|
const caseidPattern = req.query.caseidPattern + '%';
|
||||||
|
const sql = 'SELECT COUNT(id) AS count FROM popcen WHERE caseid LIKE ?';
|
||||||
|
db.query(sql, [caseidPattern], (err, results) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return res.status(500).send('Server error');
|
||||||
|
}
|
||||||
|
res.json(results[0].count);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server is running on port ${PORT}`);
|
console.log(`Server is running on port ${PORT}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user