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
0
votes
2 answers

Module exports for Express Router / Functions

Hi I am trying to export both a function (so that other routes may use this function to verify certs and also a the express router so that I can add it to my main class to mount the route on. This is because I believe the function and the route both…
nuxer
  • 438
  • 1
  • 6
  • 20
0
votes
2 answers

Express Router unable to route to another folder

I am trying to create a Node JS app with mongoDB. from main app.js I am trying to redirect to another folder named "services". Here is my folder structure - Here is my app.js - const express = require('express') const mongoose =…
0
votes
2 answers

How to handle two slashes in a row in a router using express?

Problem Hi devs, I am having trouble passing an id that has a '/' at the beginning. This is the log GET /api/v1/ GetAnimeInfo//anime/5226/tokyo-ghoul/Tokyo% 20Ghoul 404 0.466 ms - 1310 As you can see, He can not recognize two / after…
Chris Michael
  • 1,557
  • 3
  • 15
  • 23
0
votes
1 answer

How to Use Multiple Route in ExpressJS?

Is it possible to make router in ExpressJS like this? users.js const userController = ('../controllers/userController.js'); router.get('/:userName', userController.paramByUsername); router.get('/:id', userController.paramByUserId); In the…
0
votes
1 answer

Is it possible to dynamically use a route part to call passport strategy?

Currently, I have the following code for many more oath provider: // facebook router.get("/facebook", passport.authenticate("facebook", { scope: ["email"] })); router.get("/facebook/callback", passport.authenticate("facebook"), (req, res) => { …
Fabian Bosler
  • 2,310
  • 2
  • 29
  • 49
0
votes
1 answer

Express router delete and Firebase Cloud Function gives TypeError: Cannot read property 'apply' of undefined

I have a Firebase Cloud function with firebase.json config as: { "hosting": { "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites":…
0
votes
1 answer

Express route in node JS invokes two routes

I have below kind of route in my project router.get('/new', async function(req,res){ }); router.get('/:id', async function (req, res) { }); when I invoked /new route from post-man, both the routes are executing. first the route /new gets executed…
user1733952
  • 49
  • 2
  • 6
0
votes
1 answer

express router returns 404 on post method for one url

I have an express app to handle user authentication. My app.js file has app.use("/", indexRouter); app.use("/signup", signupRouter); app.use("/login", indexRouter); the signupRouter works perfect other than when I check if sign up successful and if…
sakib11
  • 496
  • 1
  • 5
  • 20
0
votes
1 answer

Express.js having issue passing API data between routes

I don't know how to pass data between routes. I have fetched json data successfully from an API but now I want to pass that data to index.hbs but iIdon't know how. I have put all code below. Main file app.js const indexRouter =…
Salman Hilabi
  • 11
  • 1
  • 1
0
votes
2 answers

Express middleware, changes to request object do not persist

I am trying to implement some middleware in Express that should be called for all routes. This middleware should alter the request object. I've tried several things already but seem to keep having the same issue. Soon as the middleware is left it…
SomeDutchGuy
  • 2,249
  • 4
  • 16
  • 42
0
votes
1 answer

Express router with middleware error handling

I have a question about error handling with middleware, specifically multer. I have this route: router.post('/', saveFile, (req, res, next) => { //rest of code }) Then I have saveFile middleware: const multer = require('multer') const…
irondsd
  • 1,140
  • 1
  • 17
  • 34
0
votes
0 answers

Heroku Error Cannot GET / Node/Express/Router

I am hosting postgres database and app on Heroku. Express Router was working on my local host. Since I have deployed to Heroku I get ERROR on index route. But URL routes work when typed in. I have tried making sure the PORT is setup correctly. I…
0
votes
1 answer

Why do I get the PUT request with POSTMAN not done?

Before embarking on the routes of my application, I have created some requests with POSTMAN of which PUT is not made to me in full. This is my configuration of my server in ExpressJS: const express = require('express'); const morgan =…
Diesan Romero
  • 1,292
  • 4
  • 20
  • 45
0
votes
0 answers

How to listen to a socket.io event on a route in order to redirect to another route in express?

I am trying to replicate the web whatsapp QRCode authentication for my Final Year Project which is an Online Medical Management System. In this system long story short, the doctor should be able to view the patients prescriptions only if the patient…
Usman Abdur Rehman
  • 334
  • 1
  • 3
  • 13
0
votes
1 answer

Express router is not routing to the correct path even though the path works

I am trying to use Express router in order to have my app.js file be less packed with code but I am having issues getting it to route to the correct place. The page that it should be routed to is localhost:5000/users/login but it is instead routing…
PhysicsLemur
  • 83
  • 1
  • 1
  • 9