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
0
votes
1 answer
Why Node.js Express was passed in different variables through middle-wear router, but always comes out the same result by different URLs
I am planning to access following two URLs, and trying to process 2 URLs with one log controller through a log router
/buy/:id/log
/sale/:id/log
Previously, the log controller was linked with 'buy' and 'sell' router files, and works fine.
After…

Max
- 1
0
votes
1 answer
User.find({}) not returning in console properly in Node.js
I am pretty new to mongodb and backend development in general, and I am having difficulty trying to query my mongodb. I am simply trying to create a route that returns all the users in "users" database that have a bullets property greater than 0. I…

Jordan
- 176
- 10
0
votes
1 answer
How to catch page not found in express router
I would like to catch 404 page not found error in express router.
I use a basic example :
const express = require('express');
const app = express();
const router = express.Router();
// ROUTER MID BEFORE
router.use((req, res, next) =>…

damjuve
- 314
- 4
- 10
0
votes
0 answers
Why does not webpack bundle .css file of react component?
I have react-ssr project (webpack, express) with two react components. First one is app component which handles a lot of api calls and stuff. This is worker component the other one is just to list something.
While my first components imported css…

Selim Mıdıkoğlu
- 136
- 3
- 13
0
votes
1 answer
How would you pass something to a router?
I've been working on an endpoint but I want it to work like bot/:id/vote
How would I get the ID to pass into that router so it goes like https://example.com/bot/512333785338216465/vote
Code
const vote =…

Johnty
- 246
- 1
- 2
- 18
0
votes
1 answer
Send JSON Data to Google Cloud Functions using Express.js Routing
Can anyone please help me to understand, why am I getting errors while calling the google cloud function, whereas I'm not getting an error if I'm calling the same function locally.
PFB the code of the function, that I'm calling from
const express =…

Yash
- 27
- 1
- 7
0
votes
1 answer
node express routing pass variable to required module
I have a main index.js file as:
var express = require('express')
require("dotenv").config();
const db = require('./services/db_service').db_connection()
const customers = require('./routes/customers');
var app = express();
app.use('/customers',…

Azima
- 3,835
- 15
- 49
- 95
0
votes
1 answer
Switching Profile routes based on user role in registration (Express.js)
A bit of a long read
I am currently building the backend for a MERN project, with quite an interesting structure (I would be changing the specifics because it is a private project).
Database: There are 4 database schemas at the moment, 1 user…

saas_joel
- 320
- 3
- 11
0
votes
1 answer
Express.Router, body-parser and post request body
I am trying to seperate my routes using express.Router and testing some post requests with Postman.
Doing a post request to /test without using router body-parser works fine and i can see the body.
Doing the exact same request to /posts which is…

LgN-
- 1
- 4
0
votes
0 answers
How to send a variable to the middleware
I have an express-router route as follows:
.post(
authController.protect,
itemController.createItem, //create Item
itemController.sendNotification('new-item'), //if user exists send notification
);
the createItem controller has some…

Mohamed Daher
- 609
- 1
- 10
- 23
0
votes
1 answer
run into an error on router basics setup TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
server.js
const express = require('express');
const connectDB = require('./config/db');
const app = express();
//connect database
connectDB();
app.get(`/`, (req, res) => res.send('API Running'));
// Define Routes
app.use('/api/users',…

Genocide
- 3
- 3
0
votes
2 answers
how to send an integer to html page while using Express.js routing
I have the following code in Express which redirects to views/index.html page. Now I also want to send some integers to index.html as soon as some function is executed in this code. Whats the fastest way to do this?
const app = express()
var path =…

user12326
- 11
- 3
0
votes
1 answer
Getting! Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client | Express
I'm getting Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client and then some long list with location of errors when doing an POST request is express route. I saw similar answers, got many but I couldn't catch where…

raviujjwal
- 25
- 2
- 12
0
votes
1 answer
TypeError: Cannot read property 'username' of undefined in node.JS / express cannot post to route
I keep getting a type Error when posting to my exercises. here is my exercises route:
const router = require("express").Router();
let Exercise = require("../models/exercise.model.js");
//get all exercises
router.get("/", (req, res) => {
…

Iurii Kogan
- 15
- 3
0
votes
0 answers
Combine ExpressJS Router and Angular 10 Routes
I develop web using NodeJs and Angular 10. for APIs, I used ExpressJs and frontend i used Angular router. i am troubling one issue. let me explain by example.
I have a route called mydomain.com/download/file -> this URL belongs to ExpressJS not…

Kaushik Makwana
- 2,422
- 9
- 31
- 50