Skip to content
Advertisement

Tag: node.js

How to access the into PUG passed object inside of an inline script without converting

Is it possible to access the whole object, which is passed into PUG, inside of an inline script without converting it with !{JSON.stringify(object)}; Using !{JSON.stringify(events)}; converts existing date-objects to strings, which than needs to be converted back. Wanted behavior: Answer Is it possible to access the whole object, wich is passed into PUG, inside of an inline script without converting

Obtain result of GET request in javascript (and Node.js)

I am trying to get a rudimentary GET request from a Node.js server when I click on a button. server.js client.js However, the console log shows: How can I get my “foobarbaz”? If I go to localhost:8080/clicks the text shows up there. Additionally, the response already seems to be a javascript object — response.json() doesn’t work. Answer The send() parameter

Get a value from a callback in another function NodeJS

I’m desperately trying to recover the value of a callback function but I have no idea how to do that. I have a function where I execute this code: Who performs this function: And which is called by this variable: I would like my `authentication’ variable to take the value returned in the callback, and I have no idea how

Method does not return whole object

When I call the method buildCommand, it does not return the property message, but I found out that if I remove some properties out of buildCommand, it works. This is the method I call This is how I call the method commandJSON looks like this UPDATE 2 Here is my whole Command Model Answer Command is just a Mongoose model.

Nodejs exits after awaiting async code without error

I’m making a build script for my angular app in node. Please have a look at the snippet: Well, the mysterious is that just after await getFiles() call, the execution halts, no error neither message anywhere is shown. I’m getting crazy investigating this. Can anybody spot the issue? Thanks Answer The main issue in your code is that you are

Discord.js Mention, User Undefined

EDIT: I have found the solution by myself, thank you everybody who sees this post! The solution is : That is the solution to this problem, it’s not the same as message.author but at least it works now! Original: I’m having a little problem with my script! Any help would be highly appreciated! Here’s the problem: This is the first

Advertisement