I have problem including controller file in nodejs router file
my router file has
var express = require('express');
var app = new express.Router();
var ctrl = require('../controller/designer.js');
var renderpages = require('../controller/renderingpages.js')
app.use(express.static('public'));
In designer.js file i have a following structure
var ctrl =
{
//controller code
}
module.exports = ctrl
in renderingpages.js file i have a following structure
var renderpages =
{
//controller code
}
module.exports = renderpages
i have this issue after including renderingpages.js
Error: Route.get() refers to some line of code that is a get request.
The error means that when your making your get request you are passing an object rather then the expected callback function needed by the request.
What it should look like:
//Format should be '/route', callback
app.get('/iamroute', function(req, res) {
//callback
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With