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
-1
votes
1 answer
Nodejs pass variable from router file to another router file
i need to pass a variable called path from router file lessonsRouter.js to another router file lessons.js
My folder structure
routes
|
+--lessons.js
|
+--lessonsRouter.js
lessonsRouter.js
const router = require('express').Router();
const lessons =…

Ahmed El-Tabarani
- 614
- 5
- 11
-1
votes
2 answers
How to write an API route with query string parameters in Express.js
Trying to write a simple route, getting a record by it's id property/column
const router = require("express").Router();
router.get("/record/:id", getRecordById) // CHANGE HERE
This is how I'm able to use for frontend ajax…

Kiran Racherla
- 219
- 3
- 12
-1
votes
2 answers
Node.js expressjs Nested Routes ,
index.js
const AuthRouter = require("./Routes/Auth/signup")
app.use("/account", AuthRouter)
signup.js
router.post("/", async (req, res) => {
res.send("Signup")
})
This Code works...
But I won't like this, It's Possible in…

Mr.k1n1
- 74
- 1
- 11
-1
votes
3 answers
In Express, how does router.get('/') in my routes directory handle requests other than '/'?
In app.js I have:
const routes = './routes/'
const usersRouter = require(routes +'users');
/*more code*/
app.use('/users', usersRouter);
In users.js, I have:
const express = require('express');
const router = express.Router();
/* GET users…

weshedrick
- 181
- 1
- 2
- 10
-1
votes
1 answer
Express different paths but same logic
i have a route like this
router.post('/policy', async (req, res, next) => {
try {
console.log(req.body);
} catch (e) {
console.log(e)
res.sendStatus(500)
}
})
I want the same logic to be executed when /role is…

Phil
- 435
- 2
- 9
- 28
-1
votes
1 answer
How to store more information on the server when POST a file?
This is my uploadRouter.js that I use to POST images to the server:
const express = require('express');
const bodyParser = require('body-parser');
const authenticate = require('../authenticate');
const multer = require('multer');
const cors =…

Hasani
- 3,543
- 14
- 65
- 125
-1
votes
1 answer
core.js:5873 ERROR TypeError: Cannot read property 'filename' of undefined
I am trying to store some images on my Node.JS server and read it from Angular client with the following codes:
image.ts:
export class Image {
fieldname: string;
originalname: string;
encoding: string;
mimetype: string;
…

Hasani
- 3,543
- 14
- 65
- 125
-1
votes
2 answers
Express route : control flow with router.use/all and router.param
I would like to validate params using these kind of middleware. The problem is that router.param is always applied before the first middleware router.all (I also tried with router.use, it doesn't work because the param is common to both…

Abk
- 376
- 3
- 10
-1
votes
3 answers
How to build large scale express.js sites
I am pretty new to the node.js and express.js landscape. However I have been trying to wrap my head around the code behind creating a site (20+ pages for example) in express.js without the code getting pretty large.
A route, when using a view…

Ben
- 361
- 2
- 13
-2
votes
1 answer
Request Parameter of type [object Event] (Express Router)
I am currently developing a NodeJS express app to manage customers.
Within this app, I have the following route:
router.get('/customers/details/:customerID', accessControl.grantAccess('readAny', 'customer'),…

Max
- 207
- 1
- 6
- 20