I am attempting to export a simple object variable from a server side JS file to a client side JS file. In the server side file I am doing some web-scraping that ultimately results in a simple object variable. In the client side file I want to be able to access that variable. I have found that I am indeed
Tag: node.js
What is the url where an express app is located at inside an electron app
I am not sure I am doing this quite right. My end goal is to send a post request from a lambda function to my electron app and create a system notification. Locally I have been able to do it from post man, but when I install the app (on linux) It doesn’t work, now I am not sure where
MongoDB returning an onject that doesnt exist
I was working on a project with MongoDB and passport, when i ran into this error, event though p1 isn’t used, it still reruns an object im guessing, because it just says that the field p1 is taken, when it isn’t. The same is happening with p2. Does anyone know why ? Answer Calling User.find return…
Why sequelize ignore the references property?
I using sequelize: I have two tables in my sql database: user and task. task_user_id in task table has references to user table: So why when I run findAll function I don’t get the user details inside the object I’m getting? Maybe something missing in my code? task.ts: user.ts: Answer In order to r…
discord.js upper case & lower case embed message not working
So I wrote a “test” command and wanted to make it in a way where when people type -test, the upper cases and lower cases don’t matter. The command should work with -test, -Test, -TEST, etc. Currently, the command only works with -test and no upper cases. I also tried changing it from toLower…
Express.Router, body-parser and post request body
I am trying to seperate my routes using express.Router and testing some post requests with Postman. Doing a post request to /test without using router body-parser works fine and i can see the body. Doing the exact same request to /posts which is using Router gives me undefined for the body. I call body-parser…
Combining some() and startsWith() javascript
I have an array with strings: const fruits = [‘Apple’, ‘Banana’, ‘Orange’] I am trying to write a function that returns true or false depending on if a string starts with any string in the array, which would be true for example ‘Applepie’ or ‘Bananabread&#…
How can I always replace a certain path parameter to another value in node.js?
My code example: Here, when name comes as foo, I want to replace it to bar because foo is an alias of bar. But inserting if-replace codes into all the blocks repeatedly doesn’t look good. Is there any other option to implement this?? I tried with: That HHH… log is printed, but the req.params.name …
How to convert string path to JSON parent-child tree using node js?
I have been trying to convert an array of paths to the JSON parent-child tree using node js. I am following @Nenad Vracar answer for building the tree link. I am using the mentioned answer which I have slightly modified. Below is my code: obj: Using that above code my output is like below: I would like to get…
Adding Buttons to a Table created dynamically in vue.js
I am trying to dynamically create buttons which are displayed in the 5th (last) column of a table, which is also created dynamically. Everything is created properly. However, upon clicking the buttons, the function is not triggered. Perhaps it is because I am using vue.js to develop my front-end. I have tried…