类型错误:connectToMongo 不是一个函数
我的代码 (Index.js)
const connectToMongo = require('./db') connectToMongo();
我的代码 (db.js)
const mongoose = require('mongoose'); const mongoURI = "mongodb://localhost:27017" const connectToMongo = ()=> { mongoose.connect(mongoURI,()=>{ console.log("Connected to mongo successfully") }) } module.export = connectToMongo;
有人可以帮忙吗?
P粉3443557152023-09-16 14:28:02
我认为这条线
module.export = connectToMongo;
应该是
module.exports = connectToMongo;