I looked all over the internet and all I could find was: "Make sure you add module.exports = router" at the end of your router file.
My router file is as follows:
let router = express.Router();
const staticOptions = {
root: path.join(__dirname, "./../../assets")
};
// a bunch of router.get() functions
module.exports = router;
// auth/google
I then go ahead and import it into my server.ts file as follows:
import * as googleAuthRouter from "./api/AccountLinking/googleAuth";
...
app.use("/auth/google", googleAuthRouter);
but I'm still getting the following error:
TypeError: Router.use() requires a middleware function but got a Object
I only have one route im importing into the server.js file. I barely just started this project. Everywhere I look online says: "you just need to do module.exports = router and it'll fix it." In this case it doesn't. What am i doing wrong?
Typescript is driving me crazy and seriously hindering my development efforts. I'm fairly close to giving up and going back to plain JS