All Questions
2,122
questions
0
votes
0
answers
6
views
Error with Express.js library with res.cookie, res.json, res.status, req.headers
Errors appear in the code:
Property 'cookie' does not exist on type 'Response any, Record string, any
Property 'json' does not exist on type 'Response any, Record string, any
Property 'status' does ...
1
vote
2
answers
43
views
What is the difference between using express.urlencoded() with extended set to true vs set to false + manual JSON stringify/parse calls?
In my NodeJS/Express server I must choose between setting extended to true or to false for the urlencoded middleware:
app.use(express.urlencoded({ extended: true/false }));
I understand that if we ...
0
votes
1
answer
28
views
request body is empty in backend while using fetch on express
I have a nodejs application where I have two scripts, server.js and script.js. The relevent code in both blocks are as follows:
script.js
const topic = document.getElementById("topic")....
0
votes
0
answers
53
views
Why is my AJAX request not working in Node.js and Express project?
I'm trying to make a request using ajax to my backend, but it always returns a 404 error, but my route exists.
Project structure:
public
-scripts
--script.js
routes
-chats.js
views
-chats.ejs
index.js
...
0
votes
2
answers
55
views
FormatException: SyntaxError: Unexpected end of JSON input
I am getting this error in my flutter app during the api integration phase. I have checked the backend apis through postman they are working fine. But when i integrate it with frontend and then check ...
-1
votes
1
answer
52
views
Reversing JSON api output to ascending order by date [duplicate]
I am currently facing a problem with the FinancialModelingPrep api. For purposes of charting, I need the api output to sort on an ascending basis, but the response comes back in descending order.
The ...
0
votes
1
answer
30
views
Ensuring integer or array of integers with express-validator
I'm puzzled with a validator while trying express.
An optional parameter I receive to my route, flags, should either be an integer or an array of integers.
The array of integers part is checked with ...
0
votes
0
answers
11
views
Google oAuth2 "Authorisation required" error
I'm getting an authentication error while trying to authenticate with my e-mail. I think maybe my code is failing to create the "token.json" file. I tried doing explicit logging to ...
1
vote
1
answer
44
views
Empty Date Parameter Returning Incorrect JSON Object in Express.js
I'm currently working on the FreeCodeCamp Timestamp Microservice project and I've encountered an issue with the implementation. While most of the requirements pass successfully, I'm having trouble ...
1
vote
1
answer
41
views
Express.js how to omit falsy fields in response
In express, how can i omit empty or falsy fields in json response?
My express app:
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res....
1
vote
3
answers
84
views
Why is the request body undefined?
I'm building a simple blog app using Express.js, and I've encountered an issue with the POST request body being undefined when I try to log it in the console:
console.log(req.body) // undefined
This ...
0
votes
0
answers
27
views
ExpressJS Postman POST request body is undefined [duplicate]
I am using the light version of Postman 11.0.12 on a Windows 10 server.
My body values always returns undefined.
If I use Query Params then key returns the correct value.
I suspect could it be this ...
0
votes
0
answers
43
views
Weird behavior when fetching an array from a server [Typescript]
I am trying to fetch an array from a server, in particular this is what I do in the backend:
this.app.get('/list', asyncHandler(async (request: Request, response: Response) => {
const ...
0
votes
1
answer
38
views
Issue with Redirecting After Deleting Blog Post in Node.js Express Application
I'm encountering an issue with redirecting users to the /blogs page after successfully deleting a blog post in my Node.js Express application. It just redirect them back to the /blogs/:id, which since ...
0
votes
0
answers
19
views
Trouble Using res.sendFile() With express.json()
I am new to express and am building a portfolio website. I have an app.post which uses express.json to get json data back from a POST request. Then depending on values in the JSON object I want to use ...