Questions tagged [express-router]

ExpressRoute is a service that enables you to create private connections between Azure datacenters and infrastructure that's on your premises or in a colocation environment.

185 questions
5
votes
1 answer

Failed to add delegation to the existing subnet

I'm trying to include in an app service an existing VNET but i have this issue: Failed to add delegation to the existing subnet.: Delegations of subnet /subscriptions Cannot be changed from [] to [Microsoft.Web/serverfarms] because it is being…
Julien
  • 199
  • 1
  • 8
5
votes
1 answer

Express middleware calls multiple times

I've checked other posts related to this topic and couldn't find the problem in my code. const myMiddleware = (fn) => { return (req, res, next) => { var fullUrl = req.protocol + '://' + req.get('host') + req.url; …
Thellimist
  • 2,939
  • 3
  • 26
  • 43
4
votes
1 answer

Express router : Router.use() requires a middleware function but got a Object

I know there are lot of questions in SO but none of them gave me a solution routes/authentication/index.js import { Router } from 'express' const router = Router(); router.get('/', (_req, _res) => console.log("Works")) // module.exports = router …
Ashutosh patole
  • 336
  • 3
  • 13
4
votes
0 answers

how to fix a mongoose strictmode error on an updateOne?

i have a model like this : Mongoose Schema var LinkedinUpdateSchema = new mongoose.Schema({ likes:{values:[PersonSchema], _total: Number}, numLikes: Number, timestamp: Number, updateComments:{ values:[CommentSchema], _total:…
3
votes
1 answer

Parallelism of Puppeteer with Express Router Node JS. How to pass page between routes while maintaining concurrency

app.post('/api/auth/check', async (req, res) => { try { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto( 'https://www.google.com' ); res.json({message: 'Success'}) } catch (e) { …
apsenT
  • 33
  • 3
3
votes
1 answer

Route.get() requires a callback function but got a [object Undefined]. What did I do wrong?

I have checked many answers in other pages and forums, but I still don't get it. What did I do wrong? Help me *edited. I have added requiring routes and app.use. It looks like function isLOggedIn is not exporting but I don't know how to do that. I…
3
votes
2 answers

How to gracefully handle promise rejection in express

I have the following express controller class ThingsController { static async index(req, res, next) { try { const things = await Thing.all(); res.json(things); } catch(err) { next(err); } } } and…
Hirurg103
  • 3,515
  • 1
  • 21
  • 44
3
votes
1 answer

Promise not returning any data for fetch return

I´m building an express router that uses mongoose to access the database. My current problem relies on this piece of code: app.use("/authreset", (req, res) => { authenticator .resetPassword( req.body.username, …
Mendes
  • 13,757
  • 24
  • 122
  • 217
2
votes
1 answer

TypeScript/Eslint throwing a 'Promise returned' error on a Express Router async route

I have the following endpoint setup to reset a database after test runs: import { getConnection } from 'typeorm'; import express from 'express'; const router = express.Router(); const resetDatabase = async (): Promise => { const connection…
HigoChumbo
  • 155
  • 1
  • 8
2
votes
1 answer

How do we pass parameters to a mounted route in nodeJS?

I'm taking a course on NodeJS, there were a few assignments related to routing, everything works fine except this part which seems a little odd: For some reason, I cannot read the parameter ID being passed to the mounted router. dish.js const…
Mike Gmez
  • 103
  • 1
  • 14
2
votes
2 answers

Make get request to third party API with api key using express.router();

I am building a react app, and in it I am retrieving data from a third party site which requires me to send the API key in the header using 'X-Auth-Token'. Currently I am making this request using fetch() api from the clientside js files. I…
Jonny
  • 593
  • 4
  • 15
2
votes
1 answer

How express.route determined route

I'm start learning about Node.js (with Express.js) and React.js. So I have some question about Express Router Let's see my part of code server.js const app = express(); const apiRouter = require("./Routes/apiRoute"); app.use("/api",…
Chanom First
  • 1,074
  • 1
  • 10
  • 22
2
votes
1 answer

What is the difference between Routing in React and Express

I am having trouble understanding the difference between routing in frontend and backend. My basic understanding is that the React-router will map a component to a URL like:
Darren rogers
  • 467
  • 1
  • 6
  • 13
2
votes
1 answer

How to app use all routes from different file

I'm trying to separate my routes, previously i'm including them to my app.js /backend/app.js const express = require("express"); const router = require("./routes"); const status = require("./routes/status"); const register =…
2
votes
1 answer

I want to add a function in where() in Model.find() method but its giving typo error included in Body

Providing the code where on passing a path is giving me a type error which is included below function maxDis(lat1, lon1, location) { var fields = location.split(':'); var lat2 = parseFloat(fields[0]); var lon2 = parseFloat(fields[1]); …
user9717489
  • 251
  • 1
  • 4
  • 8
1
2 3
12 13