skip to Main Content

Mongodb – new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))

I have tried to run this code: const connectToMongo = require('./db') const express = require('express') connectToMongo(); const app = express() const port = 3000 // Available Routes app.use('/api/auth', require('./routes/auth')) app.use('/api/notes', require('./routes/notes')) app.listen(port, () => { console.log(`Example app listening on port…

VIEW QUESTION

Node.js & Express web API not working on azure

I have created a basic app with React SPA and Node.js & Express web API using this sample https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl/1-call-api-roles The app is running fine locally- both front-end authentication and backend API calls are working as expected. When I deploy the…

VIEW QUESTION

Mongodb – How can I optimize this query in mongo db?

Here is the query: const tags = await mongo .collection("positive") .aggregate<{ word: string; count: number }>([ { $lookup: { from: "search_history", localField: "search_id", foreignField: "search_id", as: "history", pipeline: [ { $match: { created_at: { $gt: prevSunday.toISOString() }, }, }, {…

VIEW QUESTION
Back To Top
Search