News Articles node.js

React: Axios Error "Error: Network Error", My react app cannot receive axios.post response

I hava Nodejs Express Backend, React Frontend. I checked if frontend sends a request to the backend and that request is sent to backend. And the backend sends a response to the frontend but cannot receive. Frontend — request –> Backend checked. and the request reaches the backend. Frontend <– response — Backend During the […]

TypeError: match.loader.options.plugins is not a function

I am trying to use tailwindCSS in a ReactJS app These are the scripts commands in package.json file "scripts": { "start": "craco start", "build": "craco build", "test": "craco test", "eject": "react-scripts eject" } This is my craco.config.js module.exports = { style: { postcss: { plugins: [ require(‘tailwindcss’), require(‘autoprefixer’), ], }, }, } When I am […]

Nodejs limit the API access to hosted web app

I have a hosted admin panel under the domain admin.foo.com and the API hosted under the domain api.foo.com I have an open endpoint GET – api.foo.com/all-products. There is no authentication header required to access this resource. But this should be accessed only via the hosted web app. The user should not be able to copy […]

Hide functions/vuex module from clientside?

I have a vuex module that i want to be used/imported only when the user call its, but when i import it in the vuex.modules it imports globally so the functions can be viewed from devtools. I read functions/modules could be hidden with SSR either using Nuxt or another library. Is this possible? is there […]

I’m getting an error when I try to add value in my DataBase Uuing MongooDB

I would like to add to my Database using MongooDB values with the following code but when my code is running the data I want to add to my database does not add const profileModel = require(‘../DataBase/Schema.js’) function UserTotal(userId,TotalForTheSession){ const time = new Date(); var TotalTimeUserPath = ‘./Settings/UserDataTotal.json’ var TotalTimeUserRead = fs.readFileSync(TotalTimeUserPath); var TotalTimeUserFile = […]

How to Use Http Post in VS Code Extension

I am to make a VS Code Extension with Typescript in Which I need to send a request to a web api and get response. I tried using node-fetch but it seems like there is some problem with import fetch from ‘node-fetch’; Here’s my code: import fetch from ‘node-fetch’; //other stuff… fetch(url, { method: ‘POST’, […]

React useEffect endless loop for useAlert error

I searched lots of posts about infinite loops when using useEffect, but still can’t figure it out Inside the use effect, I was trying to call get products API. when I get an error then use alert showing me infinite loop error alert. const Home = () => { const alert = useAlert(); const dispatch […]

Get response from express.js server using fetch on frontend

I’m learning javascript and express. I have already made backend applications that worked correctly, but I don’t know how to send a request from a browser and receive the response from the server. This is a simple example of what I have tried: server.js: const express = require("express"); const app = express(); app.listen(3000, () => […]

Web app is working on Vercel server but not working on local host

You can checkout this repo made with react and nodejs https://github.com/samyog-dhital/full-stack-vercel-app . It is working on vercel server https://www.basantaregmi.com.np/ but not working on localhost. I followed this blog to make this web app. https://medium.com/nerd-for-tech/react-frontend-nodejs-backend-167e2904e5c9 I don’t know why but the backend api is not directing the content to the frontend route. deployed app on server […]

How to make pdf report in MERN project [closed]

Question : How to make pdf report in MERN project. I am creating a application on MERN but i want to show data in pdf report which we can print or save as a pdf Source: React – Stack Overflow

File in Heroku app not being appended to?

I have a Heroku app of the following structure: APP app.js package.json package-lock.json Procfile node_modules data.csv I’m trying to write to data.csv whenever a specific function is called. Then, I run heroku run bash -a app_name (which I believe shows the app environment). In the bash, when I run ‘cat data.csv’, the file contents haven’t […]

TypeError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters

Below is the code, ive also tried the $regex method, it only gives me the ‘Cant use $regex’ error. let query : any; if (data.search.length > 0) { query = { _id: new RegExp(`^${data.search}.*`), accountId }; } else { query = { accountId }; } const orders: any = await TEMPOrders.find(query) .lean() .exec(); Source: JavaSript […]

Why Node.js cannot run my JavaScript code in the terminal?

Can anyone please tell me why my javascript code cannot be executed? What is Uncaught SyntaxError: Unexpected Identifier? Source: JavaSript – Stack Overflow

How to add x days to unix timestamp

I have this: let currentTS = Math.floor(+new Date() / 1000) and it works, it gives me the current date in a unix timestamp. But now I want to add 14 days to the unix timestamp. How can I add 14 days to the unix timestamp, and return the unix timestamp with 14 days added to […]

Discord.js bot appearing to not be working, no errors | Could it be my indentation?

I’ve been working on this bot for a while, before I made an update which included the ‘limitedquests’ it perfectly worked. But now, as I updated it, multiple things do not work inside of it and since there are no errors, I am really unsure why. I will post the code here and explain further. […]

Electron notifications triggering multiple times

In my program, when the text changes to something else, an electron notification is sent. The issue is, the notifications are added on top of each other. For example, if the text changes 1 time, then 1 notification will be sent. If it changes another time, then 2 extra notifications will be sent (totalling up […]

SpinePlayer need a parent (Embedded Spine into React App)

I am embeeding Spine into reactjs App, the SpinePlayer method needs (id parent, Object ), When I put in index.html it works, <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="root"></div> <div id="player-container"></div> //here it work </body> </html> And when I want build a Component […]

Node js server can only listen but does not establish connection

Been trying to create a simple node.js server that send emails to specified email address with the help of sendgrid’s API. The code was running just fine earlier. However, after I tried to deploy the server using Heroku, terminal indicates the server is listening but does not respond to browser requests.(The browser is just taking […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.