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
1
vote
0 answers

Why is axios POST is called twice?

My react app uses axios for POST-requests to the server. When the server needs more than 2min for answering the request is called again. But only in FF, Chrome, NOT in IE11. I don't think that this is a Cross-Origin Resource Sharing (CORS) preflight…
dev7005
  • 11
  • 3
1
vote
1 answer

Router is mishandling static file load

In developing my website I ran across an issue with the way that my static CSS, JS, and image files are being loaded to my site. Once I navigate past the .index file or any route tree, my static directory misloads and the route index suddenly is…
1
vote
2 answers

Unexpected error while routing a bad request call with Express

Consider the following Express code: router.get('/v1/api/book/:id', function (req, res) { if (!req.params.id) res.status(401).send('Missing book id'); res.status(200).send('Book found!'); }); By invoking…
SubZeno
  • 341
  • 3
  • 15
1
vote
1 answer

Express 4, matching req.path with URL param

I made a custom middleware for Express router that allows me to whitelist certain endpoints of my API to be excluded from authentication. However I have a route where I depend on URL parameter and I can't get my middleware to work as intended with…
MerkisL
  • 115
  • 2
  • 10
1
vote
1 answer

Express Router Middleware Called Multiple Times

Using Express and Express Router. I've got a handful of files in a single directory that all implement Express.Router. I'm dynamically requiring them, adding some middleware and then attached them to a "meta" router and finally calling…
seth
  • 121
  • 1
  • 10
1
vote
0 answers

Problem with Identical component in node.js/express.js app

I'm currently facing something weird in my node js app. I have two identical component in my express.js app. 1. Stock Vacations 2. Summer Stock Vacations Each contains Model, Service, Controller and Route file. stockVacations ->…
noyruto88
  • 767
  • 2
  • 18
  • 40
1
vote
1 answer

Express: match route for language code in url

I'm trying to capture an optional :lang? param of two charachters for this routes: / // lang: undefined /en // lang: en /projects // lang: undefined /en/projects // lang: en This is my…
user7499416
1
vote
1 answer

Express Routes not resolving to endpoints

I'm running this on Firebase Cloud Functions, soin my index.js,I have the following snippet of code: const admin = require("firebase-admin"); const functions = require("firebase-functions"); const usersApi = require("./api/users") const paymentsApi…
K20GH
  • 6,032
  • 20
  • 78
  • 118
1
vote
1 answer

XHR pre-flight with Express Node.js

I'm trying to make a "MEVN" application (MongoDB, Express, Vue, NodeJs). On the client side, I have a vue component which provides a form to create a post. The post is basically a title and a description. So I have something like this : methods: { …
Cephou
  • 257
  • 5
  • 23
1
vote
0 answers

Express middleware JWT adding multiple authentication routes

I am working on a project, and I need to authenticate users through JWT, I created a route middleware for each type of users like admins, users, customers and so on. router .route('/customers') .get(ctrlCustomers.authenticate,…
Mostafa Khattab
  • 554
  • 6
  • 18
1
vote
1 answer

Cannot fetch the body in router.post but can using app.post Node js/express

I have a problem with my express app. What I am doing is having a form in handelbars. I just want to register a user according to this tutorial: https://www.learn2crack.com/2016/09/android-user-registration-login-node-client.html but I am sort of…
0
votes
0 answers

When I params in url, ExpressJS is not calling any method, and is giving me a CANNOT GET error

I have been all day trying to figure out this one. I am using Node.js, Mongoose and Express.js "version 9.7.1", A snippet from my app.js: app.use('/students', studentsRouter); app.use('/teachers', teachersRouter); My router: export const…
Jimonio
  • 1
  • 1
0
votes
1 answer

On-premises Data Gateway Compatibility with Azure ExpressRoute

I've been reviewing the documentation and haven't found the answer. Hoping someone will be able to assist here. We have an on-prem network that connects to an Azure tenant via ExpressRoute. We want to deploy an On-Premises Data Gateway to leverage…
0
votes
1 answer

throwing error message in router async middleware

This is my router: router.post('/post', isAccess, controller.create) IsAccess middleware: exports.isAccess=(request, result, next)=>{ const userid='64c1248482bcfbb533b366d5' User.findOne({_id:userid}).select({role:1}).then(user=>{ …
D. Rattansingh
  • 1,569
  • 3
  • 19
  • 30
0
votes
1 answer

Mongoose's Model.findByIdAndDelete() successfully deletes document but hangs afterwards

I am using express with mongoose and MongoDB. After creating a simple deletion route for my "Quiz" model, it deletes the document, however it never actually receives a response. I have tested with Postman and Insomnia. Here is my controller: const…