DziennikOcen/routes/users.js
2022-01-24 20:42:47 +01:00

14 lines
442 B
JavaScript

var express = require('express');
var router = express.Router();
var db=require('../database');
// another routes also appear here
// this script to fetch data from MySQL databse table
router.get('/user-list', function(req, res, next) {
var sql='SELECT * FROM plan';
db.query(sql, function (err, data, fields) {
if (err) throw err;
res.render('user-list', { title: 'Plan', userData: data});
});
});
module.exports = router;