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.
Questions tagged [express-router]
265 questions
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
- 17,489
- 35
- 150
- 263
2
votes
0 answers
How to create an express router with a parameter after the main URL (domain name) that not destroy other routes?
I am working on adding an express router for something like profile address.
The profile address is a unique name comes after the main URL.
For instance: www.domain.com/superCat
But the problem is, this route will destroy all other routes.
Here is…

Mahdi
- 206
- 2
- 14
2
votes
1 answer
Why is express matching two routes?
I have an express API with a bunch of routes.
routes.get('/', perms('read', 'document'), r(CRUD.getAll))
routes.get('/search', perms('read', 'document'), r(CRUD.search))
routes.get('/:id', …

ilrock
- 573
- 8
- 24
2
votes
1 answer
How to call router level middleware conditionally?
I have two functions to validate the request body, validation1 and validation2.
Now my task is, after parsing the incoming request body,
I need to validate the data with validation1 if the user role is premium user, otherwise I will validate the…

MI Sabic
- 367
- 2
- 7
- 18
2
votes
3 answers
Express JS (Node): adding the prefix to routes is not working
I am building a web application using the Node JS Express JS framework. Now, I am trying to add a prefix to all the routes of my application. But it is not working.
This is how I did it.
let express = require('express');
let app = express();
const…

Wai Yan Hein
- 13,651
- 35
- 180
- 372
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
- 111
- 3
- 18
2
votes
1 answer
Static CSS file not working with router Express
I am using express to build a simple login app. I am using ejs as my template engine.the file structure of my application is
package.json
server.js
routes
index.js
users.js
views
layouts.ejs
login.ejs
register.ejs
…

Nisha Dave
- 669
- 1
- 9
- 25
2
votes
1 answer
express router is not working in nodejs typescript?
I have created registerClass where i will add all the routes for this application , this node app is using typescript so all the source is in dist directory. what i am missing in below code when i call http://localhost:9001/user endpoint it is not…

hussain
- 6,587
- 18
- 79
- 152
2
votes
0 answers
Swagger NodeJS stub + Existing
Hello there community!
I have the following scenario:
Existing Node + Express app.
Existing routes in place.
Integrating the auto-generated Node stub for my API.
I have modified the startup code to merge it with my existing Express app:
//…

Francisco Carriedo Scher
- 542
- 1
- 5
- 19
2
votes
1 answer
Can I specify a specific 'views' path for each router?
According to the Express Docs, I can use .set("views", "my/views/path"); to set a generic directory to store my views in. I've set up my project so that each of my routes has its own directory with its own views (and other…

Medallyon
- 110
- 1
- 1
- 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,136
- 1
- 11
- 25
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]);
…

Yash Arora
- 360
- 1
- 5
- 10
2
votes
1 answer
Node.js : express route, query data from database and render in template.hbs view
I want to create a Node.js application that does web scraping of some sites, saves data on a PostgreSQL database and then shows visualizations (in D3.js) of this data on a web page.
I thought about splitting the front-end part (creating and…
user3808470
2
votes
1 answer
Rendering react component on express route
I have an application which uses the express server and the create-react-app front-end. The structure looks like this. ( Not including all the files in the structure - only the ones that matters )
Client-
build
etc
public
src-
…

kinny94
- 376
- 1
- 5
- 22
2
votes
3 answers
Express.Router middleware is being called on all routes after routes are registered
I have a simple app which has a login page and a section for authenticated users from where unauthenticated users are being redirected back to login. At the end of all my routes, I have app.all('*', ...) which returns 404 error page.
When I am…

Jan Jůna
- 4,965
- 3
- 21
- 27