All Questions
11,778
questions
0
votes
1
answer
27
views
Issues with Emitting Events to Socket.IO Server on Different URLs and JSON Data Conversion
I am working on a Node.js backend project using Socket.IO and am facing two issues when trying to interact with the Socket.IO endpoints via Postman:
1. Connection and Event Emission Issue on Different ...
0
votes
0
answers
40
views
Node js error Streaming Application in Node [closed]
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'express'
Require stack:
- C:\Users\Khan\Documents\project 7\index.js
(node:internal/modules/run_main:174:12) {
code:...
0
votes
0
answers
23
views
Why is Vercel not deploying my recipes.json file?
I'm working on building a recipe website where users can add recipes to it. This website is hosted on Vercel and for some reason, Vercel is not Deploying the recipes.json (or anything from the public ...
1
vote
1
answer
46
views
How to find object without existing property with JSONPath
I have the following json :
{
"data": [
{
"name": "Peter",
"excluder": 1
},
{
"name": "Sansa"
}
...
-1
votes
0
answers
23
views
Creating Persisting Unique IDs in Node.js
I’m working on a Node.js API sync project that involves assigning and persisting unique IDs to data objects. The idea is to have a item_id that gets assigned on first run and never changes. I also ...
0
votes
0
answers
45
views
Trying to access a value from an element in an array [closed]
I am trying to retrieve a value that's located inside an element, which is inside an array, all of that comes from a JSON file that is parsed to be usable. But, although I can acess the element, I can'...
0
votes
1
answer
76
views
How to use require() in React
I'm new to React.
I was wondering how to read and write to JSON file and most people use require(fs) etc...
I know that require is not standard browser function (or Reacts) but I'm confused how to ...
0
votes
0
answers
67
views
Should TypeScript downcompile named import attributes?
TypeScript 5.3 introduced support for import attributes. When building an ESM project, the compiler allows using named imports, but I don't know any javascript runtimes that support this. Should ...
0
votes
1
answer
28
views
How to generate xml doc from json object with nested array?
I am trying to generate xml doc from js object in env node.js. My js object likes:
{
"root": {
"id": 12,
"title": "root title",
&...
0
votes
0
answers
16
views
How can i scroll to the new element that's been added
Aim: Build a chat website using json, js and html, css
CODE: chatroom.js
document.addEventListener('DOMContentLoaded', () => {
const commentsDiv = document.querySelector('.chats');
const ...
0
votes
1
answer
20
views
Why can't a replacer function (argument for JSON.stringify) detect a (node) Buffer instance?
I have tried implement a replacer function for JSON.stringify() that detect if a value is buffer or not, but, when JSON.stringify call back my replacer, it is not a buffer anymore. Why?
Of course i ...
0
votes
1
answer
31
views
In CASL for ABAC, how do you pass dynamic conditions in the JSON?
I want to pass conditions into CreateMongoAbility through a JSON object, being specified in a database somewhere.
In the documentation it looks easy:
{
"action": 'delete',
"subject&...
0
votes
0
answers
22
views
React problem with setting data into constant [duplicate]
I have piece of code to put image URL from server part into JSON payload. I'll show you what it looks like in code and what output gives the browser:
const url = `${apiUrl}/api/image/${barcode}`;
...
0
votes
3
answers
42
views
How can I store the response of my axios get request as json in node.js?
I'm trying to send a request to an api using axios and store the json response in a variable. When I output the response to the console, it shows it, but when setting a variable equal to it and ...
0
votes
0
answers
39
views
Accessing API in Node to the React NextJs throwing error
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";^^^^^^
SyntaxError: Cannot use import statement outside a moduleat wrapSafe (node:internal/modules/cjs/loader:...
1
vote
1
answer
30
views
Import JSON as a variable only to get its type and ensure the import gets removed when compiled
I have a JSON file that is auto-generated in my repo, a TypeScript backend project with Node as target runtime. I import the JSON file like this, just to get the type of the JSON object:
import ...
0
votes
0
answers
15
views
Exception caught by widgets library ═RangeError (index): Invalid value: Valid value range is empty: 0
i am having this error i tried to use list of cart from api getcartproducts to store in products list then to use in my widgets i don't know what is the issue!
if some one can help me i am not expert ...
0
votes
1
answer
28
views
How to test links in a JSON file?
I have a database in JSON containing multiple links and I cannot find a library to crawl it for valid and invalid links. I want to test each URL inside to look for broken links.
Property example:
{
...
0
votes
0
answers
37
views
I get a Cannot POST /login error when i'm not sending a POST request to the /login endpoint
I'm building a web application where users can register and login using Node.js, Express, and a PostgreSQL database. However, I'm encountering an issue with my frontend and backend communication. When ...
1
vote
2
answers
48
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
0
answers
34
views
How to handle circular references in TypeScript when serializing objects to include `$ref` annotations
I have an object structure where circular references need to be represented using $ref annotations in the output.
Here is an example of the input and expected output :-
Input is -
const obj2 = { ...
0
votes
0
answers
58
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
1
answer
196
views
FedEx API Rate Quote Returns 404: "The resource you requested is no longer available"
I'm trying to integrate the FedEx API to get shipping rate quotes in my Node.js application. I've followed the documentation, but I'm consistently getting a 404 error with the message:
"The ...
1
vote
1
answer
69
views
ts-node shadows import path with JSON files, but TypeScript does not raise issue at compile time
When the "resolveJsonModule" compiler option is specified, TypeScript appears to have very unusual behaviour if a JSON file has the same name as a TypeScript file:
myModule.json
{
"...
0
votes
0
answers
13
views
HTML Static S3 site triggers APIG & Lambda & SES - but JSON field content not coming through into email
Have S3 Static site configured
Contact form triggers API Gateway to Lambda to SES
When receiving the email - all field content is 'undefined'
Website is successfully triggering lambda and SES
Postman ...
0
votes
2
answers
63
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 ...
0
votes
0
answers
40
views
Transforming request query with '%' character in parameter
My application is using the following request's handling chain:
Nginx Server -> Nest.js HTTP controller -> Nest.js service and PostgreSQL connection.
It supports sending parameters for filtering ...
0
votes
1
answer
24
views
How to append string to array inside a few objects of a JSON file in Node.js
I am making a Node.js server that stores JSON files with complex data, and I'm having trouble appending a string to an array deep into the JSON file.
Node.js code block:
io.on("connection", (...
0
votes
2
answers
90
views
How to make user data persistent in local storage in electron-app?
I'm building a tasks-to-do application using electron. As I'm new using it, I have found a lot of problems to make the tasks already uploaded persistent in the application.
I'm creating the tasks ...
-1
votes
1
answer
130
views
Unable to Load JSON Schema References in package.json and .babelrc
I'm encountering issues with JSON schema references in my package.json and .babelrc files. Here are the details:
Error in package.json:
I'm getting the following error under the first bracket in my ...
0
votes
0
answers
28
views
Error while starting the react-native app
The project was working fine, untill I added some new packages.
Now, when I try to start the app, it give me the following error:
Error: Problem validating fields in app.json. See https://docs.expo.io/...
0
votes
1
answer
59
views
Remove the deeply nested structure from the JSON and simplify it
I have a JSON which has deep nested structure, I want a generic function in Javascript/Typescript to remove that multiple deep structure. Generic like there might me any parent other than categories ...
0
votes
1
answer
363
views
how to retrieve ReadableStream data from res.body in JS
I am fetching data from my backend using fetch function and it returns a readableStream as response's body. How can I extract the data in that readable stream?
I've tries using res.json method, but it ...
0
votes
1
answer
43
views
Read and Write Into HUGE json files
I am working on Mongo ChangeStreams and storing my db changes (before and after) packets in my local system and then another script reads and upload these files to s3.
My Folder structure:
...
0
votes
0
answers
22
views
Unexpected end of JSON input error during SignIn in React app when deployed
I'm working on a React app that includes a SignIn component. Everything works fine when I run the app locally, but when I deploy it, I encounter the following error when trying to sign in
There is ...
0
votes
1
answer
129
views
JSON.parse not parsing string of array of object
In my Node.js file route I am rendering an ejs file with variables passed as stringified array of object -
let scriptArray = [
{
charValue: 'a',
encodedValueMain: 'g',
},
{
charValue:...
0
votes
0
answers
12
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 ...
2
votes
3
answers
66
views
Changes in JSON file are not reflecting
I am trying to create API and for client purpose i am using node postman.In delete method client is able to delete the json object but it is not reflecting in json file.
const express = require("...
1
vote
1
answer
48
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....
0
votes
0
answers
26
views
couldn't figure out why the data from std(standard) subcolumn are not showing up
im making a table for a management system interface, and the way the table gets its data is from mysql and the other is fetched from json file, the std data fetched from the json file is assigned to ...
1
vote
3
answers
172
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 ...
1
vote
1
answer
53
views
How to validate all properties of a schema using fluent-json-schema?
I want to be able to validate all the properties in a schema, but I'm getting an error which only contains one missing property not all of them. I have the following schema:
const headersSchema = S....
0
votes
0
answers
28
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
1
answer
40
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 ...
1
vote
0
answers
28
views
How to put it in order Excel to JS
guys
I have a program that reads data from Excel and then compares it with the numbers entered by the user.
My data is Height and Width (this is entered by the user)
and using this data I would like ...
0
votes
2
answers
64
views
Vue Cannot read properties of undefined (reading '0')
Attempting to dynamically render weather information from an API. API request is returning data that I can display in the log and on the page. However, when I attempt to display individual items in my ...
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 ...
0
votes
0
answers
25
views
POST request body is empty when sent from a browser but works fine in Postman
im making this signup form using node and express that takes an email and a password, problem is somehow the values aren't getting to the server, console loggin the request.body.email or request.body....
0
votes
1
answer
34
views
Stringified JSON data won't INSERT into mySQL(verified json format)
I'm not able to insert a JSON string into a mySQL table.
CREATE TABLE registered (
id int NOT NULL AUTO_INCREMENT,
name nvarchar(128) NOT NULL,
panels JSON NOT NULL,
PRIMARY KEY (id)
);...