, когда я пытаюсь запустить файл app.js, я получил эту ошибку.
throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
^
TypeError: Router.use() requires a middleware function but got a string
Вот мой файл app.js
const express = require("express");
const app = express();
app.use("views engine", "ejs");
app.get("/", function(req, res){
res.render("home");
});
app.get("/fellinlovewith/:thing", function(req, res){
var animal = req.param.thing;
res.render("love", {thing:animal});
});
app.get("/posts", function(req, res){
var posts = [
{book1:"author1"},
{book2:"author2"},
{book3:"author3"},
{book4:"author4"}
];
res.render("post", {posts:posts});
});
app.listen(1250,function() {
console.log("server started listining!!!");
});
Поскольку я новичок в этом, я понятия не имею, что такое маршруты и промежуточное программное обеспечение.когда я запускаю файл app.js с помощью nodemon, я получаю ту же ошибку.