outer.use() requires a middleware function but got a Object
module.exports = router;
outer.use() requires a middleware function but got a Object
module.exports = router;
TypeError: app.use() requires a middleware function
const express = require('express');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const app = express();
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
// tells express which template engine to use
app.set('view engine', 'pug');
const routes = require('./routes');
app.use(routes);
app.use((req, res, next) => {
console.log('Hello');
next();
});
app.use((req, res, next) => {
console.log("World");
next();
});
app.use((req, res, next) => {
const err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use((err, req, res, next) => {
res.locals.error = err;
res.status(err.status);
res.render('error');
});
app.listen(3000, () => {
console.log('The application is running on localhost 3000');
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us