我收到错误:
throw new TypeError('Router.use()需要中间件函数但得到' + gettype(fn))v
我是个新手,不知道发生了什么!任何帮助将不胜感激,并让我知道是否有任何其他可能有帮助的信息。提前非常感谢!!!!!!!
这是我的 app.js:
const express = require('express');
const app = express(); // object with methods; One method is router; express creates a server; app allows us to access the server; app.listen hooks up our server;
const morgan = require('morgan'); //app.use(...) morgan says console.log(wht app.use does);
const { db, Review, Toilet, User } = require('./server/db/index');
// Logger:
app.use(morgan('dev')); // implies '/' ('/', morgan('dev'));
//Body parser:
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
// public:
app.use(express.static(__dirname + '/public')); …Run Code Online (Sandbox Code Playgroud)