Home > OS >  I want to run my server in nodemon but I get an error
I want to run my server in nodemon but I get an error

Time:12-10

But I get an error saying this module.export is not a function in git bash I will add more information about the problem if needed

//Schema code

const Mongoose = require("mongoose");

const users = new Mongoose.Schema(

{fName:{type:String, required:true},favFoode:String,age:Number});

const user1 = Mongoose.model("user",users)

module.exports(user1)

//Server code

const express = require("express");

const app = express()

require("./db")

require("./module/users")

app.use(express.json());

app.listen(200, ()=>{

console.log("This server is working");

})

CodePudding user response:

you should assign the user1 variable to module.exports, like this:

module.exports = user1

Here is more information about Node.js modules: Node.js API Modules

  • Related