Questions tagged [req]
53 questions
21
votes
3 answers
Accept form-data in Nest.js
I have written auth routes in Nestjs and wanted to use it with the form-data. I got it working with URL-encoded-form-data, JSON, text, but not receiving anything in the body when I use form-data and really want it to work with form-data as on the…

usama_akram
- 237
- 1
- 2
- 7
10
votes
3 answers
Getting body-Parser is deprecated Warning In Vs code and not Able to get Body tried to use inbuilt body-parser of express
Below Is Code Of app.js file
var port = process.env.PORT || 8080; // set our port
var express = require('express');
var app = express();
var bodyParser = require('body-parser')
var cors = require('cors');
var indexRouter =…

Aryan
- 3,338
- 4
- 18
- 43
6
votes
4 answers
NodeJS - WITHOUT EXPRESS - how to get query-params?
I call my app by localhost:3000?paramname=12345
inside NodeJS I have
server.js
var http = require('http');
var app = require('./app');
var server = http.createServer(app.handleRequest).listen(3000, function () {
console.log('Server running on…

Arschibald
- 127
- 2
- 10
4
votes
2 answers
req.file.stream is undefined
I'm having troubles with node 16 and ES6. I'm trying to make a upload file controller but i'm stuck with req.file.stream which is undefined
I'm using multer to handle upload files.
The first issue was __dirname undefined that I was able to fix …

David
- 129
- 1
- 4
3
votes
0 answers
req.session undefined for express app (using Okta middleware) in chrome but not safari
There are similar questions out there, but not that directly address why this application of express-session consistently works in Safari but not in chrome.
My server code is below, which only needs to authenticate a single page with a logged out…

Jake Durell
- 169
- 1
- 12
2
votes
2 answers
What would be the response if a middleware fails in a REST API?
I am reading a code that has two files like below:
first file that uses the currentuser middleware:
const router = express.Router();
router.get("/api/users/currentuser", currentUser, (req, res) => {
res.send({ currentUser: req.currentUser || null…

GoodMan
- 542
- 6
- 19
2
votes
2 answers
My req.params.id is undefined. How can I fix my route to make it work
I am testing my function getIndividualTwitt on Postman and getting undefined when I console.log the req.params.id. This is happening exclusively in this route. I would appreciate any help that you could…
user16604664
2
votes
3 answers
req.body is saying undefined while running on postman
var express = require('express');
var mysql=require('mysql');
var bodyParser = require('body-parser');
var con=mysql.createConnection({
host:"localhost",
user:"root",
password:"",
database:"nodedb"
});
var app =…

Devesh Joshi
- 21
- 1
- 3
1
vote
1 answer
How to access value in req.body after AJAX Post on server side using Express?
I'm using AJAX to post JSON:
app.use(express.json());
app.use(bodyParser.urlencoded({extended:true}))
app.use(express.urlencoded({ extended: true}));
const rowObject=JSON.stringify(rowData)
$.ajax({
type: "POST",
url:…

ron
- 21
- 2
1
vote
1 answer
Why the my NodeJS application can't read cookies via "req.cookies"? and it shows it as a null?
My application assigns refreshToken to the reponse object as following:
newRefreshToken, { httpOnly: true, secure: true, sameSite: 'None', maxAge: 24 * 60 * 60 * 1000 });
And when I check the Postman I see the assigned JWT token there like…

GoodMan
- 542
- 6
- 19
1
vote
1 answer
Access req and res inside Passport JS strategy
I'm working on an app and I want my users to be able to connect using their Spotify accounts. I've managed to do this using the Passport JS Spotify strategy. The problem now is that I also want to provide a functionality for users to be able to…

Cătălin Avasiloaie
- 135
- 1
- 12
1
vote
1 answer
Node js http req and resp
Whenever I reload my page, the error message in the program is logged on the output terminal. I can't understand why.
const http = require('http')
const server = http.createServer((req,res)=>{
if(req.url === '/'){
res.end('Home Page')
…

kkk
- 11
- 2
1
vote
1 answer
How to require inputs in R Shiny by div tag?
I have a R Shiny app with many inputs, and before it runs the output, I want to avoid it showing the output until it has all required inputs. However, there are many outputs, and rather than type them all out, I'd like to use the req() call by their…

J.Sabree
- 2,280
- 19
- 48
1
vote
0 answers
Not able to access req.file
I am not able to access req.file in my put request. I am trying to upload a image from the form together with the other inputs to an collection in MongoDB. I am able to change the variables in the collection, except for uploading an image.
Have…

Rebecka Ljung
- 11
- 1
1
vote
2 answers
req.body is undefined in nodemailer
I have an issue with req.body being undefined in nodemailer.
React: I have the whole function written and all the data is correctly passed. console.log(data) gives me the correct object.
axios
.post(`${this.state.API_URL}/email/send`,…

kyh8725
- 21
- 4