Questions tagged [req]

53 questions
0
votes
2 answers

How to get response Headers from a https module in node.js

all. I created a function to get the response headers of a request I made using https from node.js. But I am having trouble returning the headers value for this function.. the function is written bellow. Could you guys help me? function getHeaders()…
kaio
  • 11
  • 1
  • 2
0
votes
1 answer

when does nestjs add the user object to the reqest

when i console.log the req in the middleware there is no user{} in the req @Injectable() export class MyMiddleware implements NestMiddleware { use(req: Request, res: Response, next: NextFunction) { console.log(req); next(); } } but…
raho
  • 1
0
votes
1 answer

How to send a req.body with nested objects inside using a form

In node, when using a form and an input, I can specify
And, with name="content[main]" I can achieve a req.body result that…
Artiom O
  • 405
  • 1
  • 8
  • 17
0
votes
2 answers

The body that i am trying to send in request is not going with request

Basically, I am using Thunder Client to send the requests and I am using the post request. The failure that I am facing is that whenever I send the request and also send the body contents and have already used content-type application/json in the…
adil135
  • 1
  • 1
0
votes
1 answer

Can I store image after registering user in NodeJS?

I have a register API. I have five parameters there - name:xyz, username:uname, password:pwd, profile_pic:(multipart-form-data)(imagefile) In my signup api, I am expecting multipart-form-data. I am using multer to upload file, and that is uploading…
Suraj Singh
  • 351
  • 3
  • 10
0
votes
1 answer

(Express.js) TypeError: Cannot destructure property 'name' of 'users[req.params._id]' as it is undefined

I'm having trouble with my code. It's very simple, but i don't know why it's not returning the object with the ID. All I'm getting is the error above. I followed another instruction that is identical to mine, but still. How can I return the object…
Cjmaret
  • 142
  • 9
0
votes
1 answer

req.body is returning empty data, how to fix that?

I am trying to test POST rest api from my app. My package.json file: { "name": "crypto_backend", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", …
uday
  • 569
  • 1
  • 6
  • 16
0
votes
1 answer

Where is req.variable stored?

Similar question (but NOT a duplicate): How do i store request-level variables in node.js? Consider this following code: const express = require('express'); const app = express(); app.get('/', (req, res) => { req.someVariable = "Hello"; …
code
  • 5,690
  • 4
  • 17
  • 39
0
votes
1 answer

I cannot access req.body. console.log doesn't print the request object;

const { render } = require("ejs"); const express= require("express"); const app = express(); const path = require('path'); app.use(express.static('views')); app.set('view engine','ejs'); app.set('views',…
0
votes
1 answer

Using validation in an action button

I am a little confused about the difference between req and validate in R shiny. The only real difference I can see is that validate gives a message to the user. I am building an interface and was using a bunch of hidden messages and conditional…
mauraeh
  • 13
  • 2
0
votes
0 answers

Create separate location inside nginx to enable req_limit_zone for sepcific file

I cannot setup req_limit_zone for specific file inside location since, as I figured it out, the main location catches the request and it never comes to the targeted file. Configuration inside nginx looks like this location / { …
0
votes
1 answer

Why I can't use req.body as parameter directly?

I am learning node.js. Here is the code. It works well. However, I don't understand why I can't use req.body as a parameter directly? articlesInfo[articleName].comments.push({req.body.username,req.body.text}); Thanks. import express from…
Leo Li
  • 15
  • 5
0
votes
0 answers

(Python socket) Can't estabilish a connection between a VM and main machine

i can't figure out how to send a message from client (on the main machine, windows 10) to the server (ubuntu on VM). Here's my client code on windows 10: import socket target_host = "10.0.2.15" target_port = 1236 client =…
Micio
  • 30
  • 1
  • 4
0
votes
0 answers

python making this function faster

i've been struggling for some time right now trying to find how to make this faster somehow the code def get_resellers(sellerid, price, userassetid, id): data = {"expectedCurrency":1,"expectedPrice":price,…
Max
  • 1
  • 3
0
votes
1 answer

Express validator is not working with post value?

This my current code, it is working fine, But I need to access req.body.type in createValidationFor, if I try to access code req.body validation stops working I don't know why router.post( '/login', createValidationFor('email'), …
Anudeep GI
  • 931
  • 3
  • 14
  • 45