Problem in express.router

I have exported the route from every file in routes folder but still getting the error
Router.use() requires a middleware function but got a Object

send the code for all the files in router folder, and the file where you have used those routers.

PRIVATE.JS IN ROUTES FOLDER

PRIVATE.JS IN ROUTES FOLDER const express=require(‘express’) const route=express.Router() route.get(’/’,(req,res)=>{ res.send("visible to logged in users ") }) module.exports={ route } PUBLIC.JS IN ROUTES FOLDER const express=require(‘express’) const route=express.Router() route.get(’/’,(req,res)=>{ res.send("visible to public ") }) module.exports={ route } SERVER.JS const express=require(‘express’) const app=express() app.use(’/public’,require(’./routes/public’)) app.use(’/private’,require(’./routes/private’)) app.listen(2345)

In server.js
Use app.use(’/public’,require(’./routes/public’).router)
Similarly for private also

by using this getting an error : Router.use() requires a middleware function but got a undefined app.use(’/public’,require(’./routes/public’).router) app.use(’/public’,require(’./routes/private’).router)

In server.js
Use app.use(’/public’,require(’./routes/public’).route)
Similarly for private also

use route instead of router