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.

265 questions
13
votes
3 answers

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
  • 858
  • 2
  • 9
  • 23
10
votes
1 answer

Azure: 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 used…
Julien
  • 249
  • 2
  • 9
6
votes
2 answers

Getting error PayloadTooLargeError: request entity too large in case of Using express.Router() Post call

I am trying to POST call using Router through express but I am getting request entity too large error, can anyone please help to solve the issue? I want to set mb limit to my POST call payload. I have tried app.use() limit setting through…
Shahaji
  • 175
  • 1
  • 4
  • 14
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
  • 3,757
  • 5
  • 31
  • 49
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
  • 926
  • 1
  • 7
  • 23
4
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
  • 1,053
  • 1
  • 13
  • 26
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
0 answers

express deprecated router.param solution

I newly started using express, and following a tutorial, I was using the param method from express.Router() and express said that it is deprecated. What should I use alternatively?
MAN-MADE
  • 187
  • 7
3
votes
1 answer

How do I split up my routes using Express.Router() into multiple files?

I am trying to figure out how to split the routes in my routes.js file into multiple files. My current routes.js file looks like this: const pullController = require('./controllers/pullController'); const userController =…
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
  • 4
3
votes
0 answers

How to get the exact URL path defined by me in express middleware without path parameter values and query parameters?

I have a requirement to get the exact path of the URL for use in another middleware for resusability purposes. It should return the url without the path parameter converted to specific value, and without the query parameter. Eg: if the user enters…
lanxion
  • 1,350
  • 1
  • 7
  • 20
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…
Booi Mangang
  • 31
  • 1
  • 4
3
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
  • 627
  • 2
  • 8
  • 17
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
  • 4,783
  • 2
  • 34
  • 50
3
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 =…
1
2 3
17 18