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

14 lines
445 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('/plan', function(req, res, next) {
var sql='SELECT id_plan FROM plan';
db.query(sql, function (err, data, fields) {
if (err) throw err;
res.render('plan', { title: 'Plan lekcji', userData: data});
});
});
module.exports = router;