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
vote
2 answers
How to use fetch from node-fetch inside an express router get request
I'm using node-fetch to get external resources from github (user repos) inside an express router get request as follows.
import fetch from 'node-fetch
router.get('/github/:username', async (req, res) => {
try {
const uri =…

Umar Khan
- 13
- 1
- 4
1
vote
0 answers
Error: Route.put() requires a callback function but got a [object Undefined]
When I run yarn build, everything works fine but, when I run yarn start, I get the following error in terminal -
$ NODE_ENV=production node ./dist/server.generated.js
/home/prithvi/Desktop/Socialize-app/node_modules/express/lib/router/route.js:202
…

justExploring
- 43
- 5
1
vote
0 answers
Express server not responding route request
My express server is not responding to any of the route requests, whatever I do no luck.
following are the routes I am trying to…

Ayush Tiwari
- 59
- 5
1
vote
0 answers
Cannot read property 'email' of undefined. NodeJS Mongoose
Problem lies somewhere in file handling
Everytime i run post request the request keeps on going in POSTMAN and i see error on console
My Headers in routes File
const express = require('express')
const router = express.Router();
const app =…

Sarah
- 81
- 7
1
vote
3 answers
Why this route is working in express when not defined anywhere?
I'm new to express and stuck in a problem while following some tutorial.
The problem is why this URL http://localhost:8000/user/profile is working? I haven't defined any route for /user/profile. If possible a deep explanation on this. How is this…

Ayush Sachan
- 29
- 6
1
vote
1 answer
Add authentication check on every child endpoint of a express router
I have a express router and I only want authorized users to access routes of that router. I am using passport middleware. So I can just add a check for req.user in every endpoint like:
router.get("/", async (req, res) => {
if (!req.user) {
…

Aman Kumar
- 15
- 1
- 6
1
vote
0 answers
Express Multiple Route Match Throws Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
In my node express application, I have a couple of routes, one is a specific route and a wildcard route (for unmatched routes), below is my routes.
// Routes
app.options('/*', (req, res) => {
// Return CORS headers
…

gokublack
- 1,260
- 2
- 15
- 36
1
vote
1 answer
Advanced optional routing in express
I'm Trying to build crud application using express and node.js
example query string
/table/?id=78&title=someTitle&code=3
where ID, Title And Code are optional. meaning:
If none entered, return all rows.
If id entered, return row that has that…

Re9iNee
- 412
- 5
- 15
1
vote
0 answers
Next.js - TypeError fn is not a function
Inside my routes/index.js file I have:
const express = require("express");
const authController = require("../controllers/authController");
const router = express.Router();
console.log('ROUTES index.js')
/* Error handler for async / await…

preston
- 3,721
- 6
- 46
- 78
1
vote
1 answer
How to change express router path without changing URL?
I am statically serving my site from one directory. I have one dynamic route for setting the URL parameter roomCode. I want all routes to this path to serve the root index page without changing the URL on the client (that way I can still use the…

Trevin Avery
- 2,751
- 2
- 20
- 31
1
vote
1 answer
express-validator : How to check for an Array of Email IDs?
Let's say I have a post request with body :
{
"from":"mr.x@example.com",
"recipient":[
"john.doe@email.com",
"ramesh.suresh@example.com",
"jane.doe"
]
}
Here is my request handler :
const { validationResult, body…

Rohit Rane
- 2,790
- 6
- 25
- 41
1
vote
4 answers
Express Route calling methods at initialization phase?
I have a basic express app, where app.ts looks like
import * as express from "express";
const application: express.Application = express();
application.get("/", function(
request: express.Request,
response: express.Response
) {
…

Rajendra kumar Vankadari
- 2,247
- 1
- 16
- 16
1
vote
0 answers
when using react with express, is that SSR or static or SPA?
This is my server.js file.
const express = require('express');
const connectDB = require('./config/db');
const path = require('path');
const app = express();
// Connect Database
connectDB();
// Init Middleware
app.use(express.json({ extended:…

joshua
- 458
- 5
- 18
1
vote
2 answers
Multiple file uploads in nodejs using express-fileupload?
Currently I am able to post this to mongodb. It works fine.
PROBLEM
Instead of one attachment, I should be able to post many attachments independent of each other, there will be N different buttons available for the N uploads.
const form = (req,…

Zahir Masoodi
- 546
- 7
- 23
1
vote
0 answers
Error on performing axios callouts to a node.js server
I'm really struggling trying to understand what's going on here.
I'm trying to create a tracker in order to see what pages my visitors navigates more frequently;
Before starting :
BE : Node.js and Express
FE : VUE.js with axios in order to perform…

calibro22
- 26
- 5