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]
185 questions
0
votes
1 answer
Express JS Multiple Route files not working
I am using AngularJS with NodeJS as backend. I have 2 route files - route1.api.js and route2.api.js. They are used in server.js as follows:
const route1Api= require("./src/api/route1.api");
const route2Api=…
Clairvoyant
- 71
- 1
- 8
0
votes
1 answer
Express.js internal, where are stored the mount paths on the app object?
I'm facing a very specific use case, where I need to access the mount paths of various express sub apps when iterating over the app object.
Sample code :
const express = require("express")
const app = express()
app.use("/users", new…
Radioreve
- 2,611
- 2
- 16
- 28
0
votes
1 answer
Add existing ExpressRoute to existing Azure Fabric Cluster
I created a Azure Fabric Cluster without ExpressRoute without any gateway. Created from Azure portal with all default options. Now, my fabric cluster service is not able to access to onprem servers. I understand I need to setup a ExpressRoute for…
user43286
- 2,001
- 2
- 23
- 38
0
votes
1 answer
How to work with implied function parameters in NodeJS
In my website's routes file, I have a function like this:
router.post('/', ctrl1.validate, ctrl2.doSomething)
With the validate function looking like this:
function(req,res,next){
var errors = validator.checkForm('myForm')
if(errors){
…
Isaac Krementsov
- 574
- 1
- 8
- 25
0
votes
1 answer
Node Express Router can't get response params
I can not retrieve route parameters with a simple express.Router() in an web app.
Here is a minimal example:
var http = require('http');
const express = require('express');
const app = express();
app.use('/hello/:world', express.Router()
…
s.k
- 2,221
- 4
- 21
- 42
0
votes
2 answers
How to get params from url with React front end and express backend?
I'm building an react app with an express backend. I'm now adding socket io chat functionality to the front end. Everything works as expected but now I want to access params from the url to set the socket-io channel name.
I want the user to visit…
grabury
- 4,667
- 9
- 48
- 92
0
votes
1 answer
Mongoose errors doesn't raise from router to app
There's single api application like this:
const express = require('express')
const app = express()
const router = require('express').Router()
...
route.post('/dogs', (req, res, next) => {
const dog = new Dog() // it defined in real app
…
Iworb
- 431
- 5
- 23
0
votes
1 answer
Express router regex issue
I am using express router in my project, I am facing following problem,
I have 2 routes as follows
router.get("/user/:id", (req, res) => {
console.log("---- ABCD ---");
});
router.get("/user/list", (req, res) => {
console.log("---- PQRS…
prashant
- 117
- 2
- 10
0
votes
2 answers
How to get a 404 response with a invalid route parameter in Node.js
I have a node.js API I am working on that has some parameter variables in the URL.
One of the tasks I need to achieve is that when a particular id is not valid (as in the id number does not exist in the sqlite database), is that it returns a…
Chocolol
- 1
0
votes
1 answer
Mean Stack Root Routing is not working
Can someone help me why default route is not working in my Mean App, But the next routing works
Here when I open http://localhost:3000 I am not able to see any output, But I have defined route in route.js which is working
var express =…
Ron
- 1,024
- 4
- 24
- 52
0
votes
1 answer
expressJS routing issue, simple stuff not resolving
I've recently moved all my route code into separate files, but now my route resolution is spotty. Here's a simple example -
My app.js
const express = require('express');
const app = express();
var dataLoader =…
j-p
- 3,410
- 7
- 45
- 79
0
votes
1 answer
Router.use() requires a middle function, but got an Object. module.exports = router exists on page
from app.js
// REQUIRE ROUTES
var commentRoutes = require("./routes/comments"),
bpostRoutes = require("./routes/bposts"),
indexRoutes = require("./routes/index");
//USE ROUTES
app.use("/", indexRoutes);
app.use("/bposts",…
Richard Bretton
- 37
- 1
- 8
-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
- 76
- 6
-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
- 56
- 7
-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
- 99
- 1
- 1
- 7